altair.UnitSpec#
- class altair.UnitSpec(mark=Undefined, data=Undefined, description=Undefined, encoding=Undefined, name=Undefined, params=Undefined, projection=Undefined, title=Undefined, transform=Undefined, **kwds)#
UnitSpec schema 的包装器。
单元(单视图)规范的基本接口。
- 参数:
- markdict,
Mark
,AnyMark
,BoxPlot
,MarkDef
,ErrorBar
,ErrorBand
,BoxPlotDef
,ErrorBarDef
,ErrorBandDef
,CompositeMark
,CompositeMarkDef
, Literal[‘arc’, ‘area’, ‘bar’, ‘image’, ‘line’, ‘point’, ‘rect’, ‘rule’, ‘text’, ‘tick’, ‘trail’, ‘circle’, ‘square’, ‘geoshape’, ‘boxplot’, ‘errorband’, ‘errorbar’] 描述标记类型的字符串(可选值为
"bar"
,"circle"
,"square"
,"tick"
,"line"
,"area"
,"point"
,"rule"
,"geoshape"
, 和"text"
)或标记定义对象。- datadict,
Data
,UrlData
,Generator
,NamedData
,DataSource
,InlineData
,SphereGenerator
,SequenceGenerator
,GraticuleGenerator
, None 描述数据源的对象。设置为
null
以忽略父数据源。如果未设置数据,则从父级派生。- descriptionstr
此标记的描述,用于注释目的。
- encodingdict,
Encoding
编码通道和字段定义之间的键值映射。
- namestr
可视化图的名称,用于后续引用。
- paramsSequence[dict,
SelectionParameter
] 参数数组,可以是简单变量,也可以是将用户输入映射到数据查询的更复杂选择。
- projectiondict,
Projection
定义地理投影属性的对象,将应用于
"geoshape"
标记的shape
路径以及其他标记的latitude
和"longitude"
通道。- titlestr, dict,
Text
, Sequence[str],TitleParams
图表的标题。
- transformSequence[dict,
Transform
,BinTransform
,FoldTransform
,LoessTransform
,PivotTransform
,StackTransform
,ExtentTransform
,FilterTransform
,ImputeTransform
,LookupTransform
,SampleTransform
,WindowTransform
,DensityTransform
,FlattenTransform
,QuantileTransform
,TimeUnitTransform
,AggregateTransform
,CalculateTransform
,RegressionTransform
,JoinAggregateTransform
] 数据转换数组,例如过滤和新字段计算。
- markdict,
- __init__(mark=Undefined, data=Undefined, description=Undefined, encoding=Undefined, name=Undefined, params=Undefined, projection=Undefined, title=Undefined, transform=Undefined, **kwds)#
方法
__init__
([mark, data, description, ...])返回对象的副本。
Return a copy of the object.
from_dict
(dct[, validate])从字典表示构建类。
from_json
(json_string[, validate])从有效的 JSON 字符串实例化对象。
resolve_references
([schema])在此对象 schema 或根 schema 的上下文中解析引用。
to_dict
([validate, ignore, context])返回对象的字典表示。
to_json
([validate, indent, sort_keys, ...])将此对象的 JSON 表示作为字符串发出。
validate
(instance[, schema])在根 schema 的上下文中根据类 schema 验证实例。
validate_property
(name, value[, schema])在根 schema 的上下文中根据属性 schema 验证属性。