altair.Chart

altair.Chart(data=Undefined, encoding=Undefined, mark=Undefined, width=Undefined, height=Undefined, **kwargs)

Создаёт обычную диаграмму Altair/Vega-Lite.

Все свойства Chart можно передать конструктору, однако привычнее использовать методы mark_point(), encode(), transform_filter(), properties() и другие. Подробнее см. документацию Altair.

Параметры

data — Data

Объект, описывающий источник данных.

mark — AnyMark

Объект MarkDef или CompositeMarkDef либо строка с типом примитива: arc, area, bar, circle, geoshape, image, line, point, rule, rect, square, text, tick, trail, boxplot, errorband или errorbar.

encoding — FacetedEncoding

Словарь, связывающий каналы кодирования с определениями полей.

autosize — anyOf(AutosizeType, AutoSizeParams)

Способ определения размера визуализации. Строка принимает значения pad, fit или none. Объект позволяет дополнительно задать размер содержимого и автоматическое изменение размеров. Значение fit поддерживается только для отдельных и многослойных представлений без rangeStep. По умолчанию: pad.

background — string

Цвет фона визуализации в CSS. По умолчанию: отсутствует, фон прозрачный.

config — Config

Объект конфигурации Vega-Lite. Допустим только на верхнем уровне спецификации.

description — string

Описание примитива для комментариев.

height — float

Высота визуализации.

name — string

Имя визуализации для последующих ссылок на неё.

padding — Padding

Отступ в пикселях от края холста до прямоугольной области данных. Число задаёт одинаковый отступ со всех сторон, а объект вида {"left": 5, "top": 5, "right": 5, "bottom": 5} — отдельно для каждой стороны. По умолчанию: 5.

projection — Projection

Объект свойств географической проекции. Работает с geoshape, а также с point или line, имеющими каналы X, X2, Y или Y2 типа latitude либо longitude.

selection — Mapping(required=[])

Словарь имён выборов и их определений.

title — anyOf(string, TitleParams)

Заголовок диаграммы.

transform — List(Transform)

Массив преобразований данных, например фильтрации и вычисления новых полей.

width — float

Ширина визуализации.

Конструктор

__init__(data=Undefined, encoding=Undefined, mark=Undefined, width=Undefined, height=Undefined, **kwargs)

Методы

Метод Описание
__init__
add_params(*params) Добавляет один или несколько параметров к диаграмме.
add_selection(*params) add_selection устарел; используйте add_params.
configure(arc, area, aria, autosize, …) См. Config, обёртку схемы.
configure_arc(align, angle, aria, ariaRole, …) См. RectConfig, обёртку схемы.
configure_area(align, angle, aria, ariaRole, …) См. AreaConfig, обёртку схемы.
configure_axis(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisBand(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisBottom(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisDiscrete(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisLeft(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisPoint(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisQuantitative(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisRight(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisTemporal(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisTop(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisX(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisXBand(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisXDiscrete(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisXPoint(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisXQuantitative(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisXTemporal(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisY(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisYBand(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisYDiscrete(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisYPoint(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisYQuantitative(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_axisYTemporal(aria, bandPosition, description, disable, …) См. AxisConfig, обёртку схемы.
configure_bar(align, angle, aria, ariaRole, …) См. BarConfig, обёртку схемы.
configure_boxplot(box, extent, median, outliers, …) См. BoxPlotConfig, обёртку схемы.
configure_circle(align, angle, aria, ariaRole, …) См. MarkConfig, обёртку схемы.
configure_concat(columns, spacing, **kwds) См. CompositionConfig, обёртку схемы.
configure_errorband(band, borders, extent, interpolate, …) См. ErrorBandConfig, обёртку схемы.
configure_errorbar(extent, rule, size, thickness, …) См. ErrorBarConfig, обёртку схемы.
configure_facet(columns, spacing, **kwds) См. CompositionConfig, обёртку схемы.
configure_geoshape(align, angle, aria, ariaRole, …) См. MarkConfig, обёртку схемы.
configure_header(format, formatType, labelAlign, labelAnchor, …) См. HeaderConfig, обёртку схемы.
configure_headerColumn(format, formatType, labelAlign, labelAnchor, …) См. HeaderConfig, обёртку схемы.
configure_headerFacet(format, formatType, labelAlign, labelAnchor, …) См. HeaderConfig, обёртку схемы.
configure_headerRow(format, formatType, labelAlign, labelAnchor, …) См. HeaderConfig, обёртку схемы.
configure_image(align, angle, aria, ariaRole, …) См. RectConfig, обёртку схемы.
configure_legend(aria, clipHeight, columnPadding, columns, …) См. LegendConfig, обёртку схемы.
configure_line(align, angle, aria, ariaRole, …) См. LineConfig, обёртку схемы.
configure_mark(align, angle, aria, ariaRole, …) См. MarkConfig, обёртку схемы.
configure_point(align, angle, aria, ariaRole, …) См. MarkConfig, обёртку схемы.
configure_projection(center, clipAngle, clipExtent, coefficient, …) См. ProjectionConfig, обёртку схемы.
configure_range(category, diverging, heatmap, ordinal, …) См. RangeConfig, обёртку схемы.
configure_rect(align, angle, aria, ariaRole, …) См. RectConfig, обёртку схемы.
configure_rule(align, angle, aria, ariaRole, …) См. MarkConfig, обёртку схемы.
configure_scale(animationDuration, bandPaddingInner, bandPaddingOuter, bandWithNestedOffsetPaddingInner, …) См. ScaleConfig, обёртку схемы.
configure_selection(interval, point, **kwds) См. SelectionConfig, обёртку схемы.
configure_square(align, angle, aria, ariaRole, …) См. MarkConfig, обёртку схемы.
configure_text(align, angle, aria, ariaRole, …) См. MarkConfig, обёртку схемы.
configure_tick(align, angle, aria, ariaRole, …) См. TickConfig, обёртку схемы.
configure_title(align, anchor, angle, aria, …) См. TitleConfig, обёртку схемы.
configure_tooltipFormat(normalizedNumberFormat, normalizedNumberFormatType, numberFormat, numberFormatType, …) См. FormatConfig, обёртку схемы.
configure_trail(align, angle, aria, ariaRole, …) См. LineConfig, обёртку схемы.
configure_view(clip, continuousHeight, continuousWidth, cornerRadius, …) См. ViewConfig, обёртку схемы.
copy(deep, ignore) Возвращает копию объекта.
display(renderer, theme, actions, **kwargs) Отображает диаграмму в Jupyter Notebook или JupyterLab.
encode(angle, color, column, description, …) Связывает свойства данных с визуальными свойствами диаграммы; см. FacetedEncoding.
facet(facet, row, column, data, …) Создаёт фасетную диаграмму из текущей.
from_dict(dct, validate) Создаёт Chart из представления в виде словаря.
from_json(json_string, validate, **kwargs) Создаёт экземпляр объекта из корректной строки JSON.
interactive(name, bind_x, bind_y) Делает шкалы осей диаграммы интерактивными.
mark_arc(align, angle, aria, ariaRole, …) Задаёт тип примитива arc; см. MarkDef.
mark_area(align, angle, aria, ariaRole, …) Задаёт тип примитива area; см. MarkDef.
mark_bar(align, angle, aria, ariaRole, …) Задаёт тип примитива bar; см. MarkDef.
mark_boxplot(box, clip, color, extent, …) Задаёт тип примитива boxplot; см. BoxPlotDef.
mark_circle(align, angle, aria, ariaRole, …) Задаёт тип примитива circle; см. MarkDef.
mark_errorband(band, borders, clip, color, …) Задаёт тип примитива errorband; см. ErrorBandDef.
mark_errorbar(clip, color, extent, opacity, …) Задаёт тип примитива errorbar; см. ErrorBarDef.
mark_geoshape(align, angle, aria, ariaRole, …) Задаёт тип примитива geoshape; см. MarkDef.
mark_image(align, angle, aria, ariaRole, …) Задаёт тип примитива image; см. MarkDef.
mark_line(align, angle, aria, ariaRole, …) Задаёт тип примитива line; см. MarkDef.
mark_point(align, angle, aria, ariaRole, …) Задаёт тип примитива point; см. MarkDef.
mark_rect(align, angle, aria, ariaRole, …) Задаёт тип примитива rect; см. MarkDef.
mark_rule(align, angle, aria, ariaRole, …) Задаёт тип примитива rule; см. MarkDef.
mark_square(align, angle, aria, ariaRole, …) Задаёт тип примитива square; см. MarkDef.
mark_text(align, angle, aria, ariaRole, …) Задаёт тип примитива text; см. MarkDef.
mark_tick(align, angle, aria, ariaRole, …) Задаёт тип примитива tick; см. MarkDef.
mark_trail(align, angle, aria, ariaRole, …) Задаёт тип примитива trail; см. MarkDef.
open_editor(fullscreen, validate) Открывает спецификацию в редакторе диаграмм Vega через браузер по умолчанию.
project(type, center, clipAngle, clipExtent, …) Добавляет географическую проекцию к диаграмме.
properties(**kwargs) Задаёт свойства Chart верхнего уровня.
repeat(repeat, row, column, layer, …) Возвращает RepeatChart, созданный из диаграммы.
resolve_axis(x, y, **kwds) См. AxisResolveMap, обёртку схемы.
resolve_legend(angle, color, fill, fillOpacity, …) См. LegendResolveMap, обёртку схемы.
resolve_references(schema) Разрешает ссылки в контексте схемы объекта или корневой схемы.
resolve_scale(angle, color, fill, fillOpacity, …) См. ScaleResolveMap, обёртку схемы.
save(fp, format, override_data_transformer, scale_factor, …) Сохраняет диаграмму в файл в одном из поддерживаемых форматов.
serve(ip, port, n_retries, files, …) serve устарел; используйте show.
show() Отображает диаграмму активным средством отображения.
to_dict(validate, format, ignore, context) Преобразует Chart в словарь для экспорта JSON.
to_html(base_url, output_div, embed_options, json_kwds, …) Встраивает спецификацию Vega/Vega-Lite в HTML-страницу.
to_json(validate, indent, sort_keys, format, …) Преобразует диаграмму в строку JSON.
to_url(fullscreen, validate) Преобразует диаграмму в URL, открывающий спецификацию в редакторе Vega.
transform_aggregate(aggregate, groupby, **kwds) Добавляет AggregateTransform к схеме.
transform_bin(as_, field, bin, **kwargs) Добавляет BinTransform к схеме.
transform_calculate(as_, calculate, **kwargs) Добавляет CalculateTransform к схеме.
transform_density(density, as_, bandwidth, counts, …) Добавляет DensityTransform к спецификации.
transform_extent(extent, param) Добавляет ExtentTransform к спецификации.
transform_filter(predicate, empty, *more_predicates, **constraints) Добавляет FilterTransform к спецификации.
transform_flatten(flatten, as_) Добавляет FlattenTransform к схеме.
transform_fold(fold, as_) Добавляет FoldTransform к спецификации.
transform_impute(impute, key, frame, groupby, …) Добавляет ImputeTransform к схеме.
transform_joinaggregate(joinaggregate, groupby, **kwargs) Добавляет JoinAggregateTransform к схеме.
transform_loess(on, loess, as_, bandwidth, …) Добавляет LoessTransform к спецификации.
transform_lookup(lookup, from_, as_, default, …) Добавляет DataLookupTransform или SelectionLookupTransform к диаграмме.
transform_pivot(pivot, value, groupby, limit, …) Добавляет PivotTransform к диаграмме.
transform_quantile(quantile, as_, groupby, probs, …) Добавляет QuantileTransform к диаграмме.
transform_regression(on, regression, as_, extent, …) Добавляет RegressionTransform к диаграмме.
transform_sample(sample) Добавляет SampleTransform к схеме.
transform_stack(as_, stack, groupby, offset, …) Добавляет StackTransform к схеме.
transform_timeunit(as_, field, timeUnit, **kwargs) Добавляет TimeUnitTransform к схеме.
transform_window(window, frame, groupby, ignorePeers, …) Добавляет WindowTransform к схеме.
transformed_data(row_limit, exclude) Вычисляет преобразования Chart.
validate(instance, schema) Проверяет экземпляр по схеме класса в контексте корневой схемы.
validate_property(name, value, schema) Проверяет свойство по его схеме в контексте корневой схемы.