Movatterモバイル変換


[0]ホーム

URL:


  • Overview
  • View Specification
  • Data / Datasets
  • Transform
  • Mark
  • Encoding
  • Projection
  • View Composition
  • Parameter
  • Config

  • Property Types
  • Tooltip
  • Invalid Data
  • Error Bar

    Edit this page
    // Single View Specification{  "data": ... ,  "mark": "errorbar",  "encoding": ... ,  ...}

    An error bar summarizes an error range of quantitative values using a set of summary statistics, representing by rules (and optional end ticks). Error bars in Vega-Lite can either be used to aggregate raw data or directly visualize aggregated data.

    To create an error bar, setmark to"errorbar".

    Documentation Overview

    Error Bar Mark Properties

    An error bar’s mark definition contain the following properties:

    PropertyTypeDescription
    typeErrorBar

    Required. The mark type. This could a primitive mark type (one of"bar","circle","square","tick","line","area","point","geoshape","rule", and"text") or a composite mark type ("boxplot","errorband","errorbar").

    extentString

    The extent of the rule. Available options include:

    • "ci": Extend the rule to the 95% bootstrapped confidence interval of the mean.
    • "stderr": The size of rule are set to the value of standard error, extending from the mean.
    • "stdev": The size of rule are set to the value of standard deviation, extending from the mean.
    • "iqr": Extend the rule to the q1 and q3.

    Default value:"stderr".

    orientString

    Orientation of the error bar. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined.

    colorColor |Gradient |ExprRef

    Default color.

    Default value:"#4682b4"

    Note:

    • This property cannot be used in astyle config.
    • Thefill andstroke properties have higher precedence thancolor and will overridecolor.
    opacityNumber

    The opacity (value between [0,1]) of the mark.

    Besides the properties listed above,rule andticks can be used to specify the underlyingmark properties for differentparts of the error bar as well.

    Using Error Bars to Aggregate Raw Data

    If the data is not aggregated yet, Vega-Lite will aggregate the data based on theextent properties in the mark definition.

    1. Error bars showing standard error is the default error bar in Vega-Lite. It can also be explicitly specified by settingextent to"stderr". The length of lower and upper rules represent standard error. By default, the rule marks expand from the mean.
    1. Error bar showing standard deviation can be specified by settingextent to"stdev". For this type of error bar, the length of lower and upper rules represent standard deviation. Like an error bar that shows Standard Error, the rule marks expand from the mean by default.
    1. Error bars showing confidence interval can be specified by settingextent to"ci". For this type of error bar, the rule marks expand from the"ci0" value to"ci1" value, as defined inaggregate.
    1. Error bars showing interquartile range can be specified by settingextent to"iqr". For this type of error bar, the rule marks expand from the first quartile to the third quartile.

    Using Error Bars to Visualize Aggregated Data

    1. Data is aggregated with low and high values of the error bars

    If the data is already pre-aggregated with low and high values of the error bars, you can directly specifyx andx2 (ory andy2) to use error bar as a ranged mark.

    1. Data is aggregated with center and error value(s)

    If the data is already pre-aggregated with center and error values of the error bars, you can directly specityx as center,xError andxError2 as error values extended from center (ory,yError, andyError2). Ifx/yError2 is omitted, error bars have symmetric error values.

    Error bar with symmetric error values:

    Error bar with asymmetric error values:

    Note if error is pre-aggregated with asymmetric error values one ofx/yError andx/yError2 has to be positive value and other has to be negative value

    Dimension & Orientation

    Vega-Lite supports both 1D and 2D error bars:

    {:#1d} A1D error bar shows the error range of a continuous field.

    The orientation of an error bar is automatically determined by the continuous field axis. For example, you can create a vertical 1D error bar by encoding a continuous field on the y axis.

    {:#2d} A2D error bar shows the error range of a continuous field, broken down by categories.

    For 2D error bars with one continuous field and one discrete field, the error bars will be horizontal if the continuous field is on the x axis.

    Alternatively, if the continuous field is on the y axis, the error bar will be vertical.

    The Parts of Error Bars

    Under the hood, theerrorbar mark is acomposite mark that expands into a layered plot. For example,a basic 1D error bar shown above is expanded to:

    We can customize different parts of the error barmark definition orconfig.

    For example, we can add the error bar’s end ticks and customize it by settingticks totrue or adding a mark property toticks, such as settingcolor to"teal":

    Color, and Opacity Encoding Channels

    You can customize the color, size, and opacity of the bar in theerrorbar by using thecolor, andopacityencoding channels, which applied to the wholeerrorbar.

    Here is an example of aerrorbar with thecolor encoding channel set to{"value": "#4682b4"}.

    Tooltip Encoding Channels

    You can add custom tooltips to error bars. The custom tooltip will override the default error bar’s tooltips.

    Mark Config

    {  "errorbar": {    "extent": ...,    "rule": ...,    "ticks": ...  }}

    Theerrorbar config object sets the default properties forerrorbar marks.

    The error bar config can contain allerror bar mark properties but currently does not supportcolor,opacity, andorient. Please see issue#3934 for details.


[8]ページ先頭

©2009-2025 Movatter.jp