Skip to content

Commit

Permalink
add more documentation on new arc mark
Browse files Browse the repository at this point in the history
  • Loading branch information
mattijn committed Oct 31, 2021
1 parent dfcbc2f commit 9a365d4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
20 changes: 18 additions & 2 deletions doc/user_guide/compound_charts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,24 @@ The :meth:`Chart.repeat` method is the key here: it lets you specify a set of
encodings for the row and/or column which can be referred to in the chart's
encoding specification using ``alt.repeat('row')`` or ``alt.repeat('column')``.

Currently ``repeat`` can only be specified for rows and column (not, e.g., for
layers) and the target can only be encodings (not, e.g., data transforms)
Another option to use the ``repeat`` method is for layering. Here below the
columns ``US_Gross`` and ``Worldwide_Gross`` are layered on the ``y``-axis
using ``alt.repeat('layer')``:

.. altair-plot::

import altair as alt
from vega_datasets import data

source = data.movies()

alt.Chart(source).mark_line().encode(
x=alt.X("IMDB_Rating", bin=True),
y=alt.Y(alt.repeat('layer'), aggregate='mean', title="Mean of US and Worldwide Gross"),
color=alt.ColorDatum(alt.repeat('layer'))
).repeat(layer=["US_Gross", "Worldwide_Gross"])

Currently ``repeat`` can only be encodings (not, e.g., data transforms)
but there is discussion within the Vega-Lite community about making this pattern
more general in the future.

Expand Down
3 changes: 3 additions & 0 deletions doc/user_guide/encoding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ xError :class:`XError` The x-axis error value N/A
yError :class:`YError` The y-axis error value N/A
xError2 :class:`XError2` The second x-axis error value N/A
yError2 :class:`YError2` The second y-axis error value N/A
theta :class:`Theta` The start arc angle :ref:`gallery_radial_chart`
theta2 :class:`Theta2` The end arc angle (radian) :ref:`gallery_pacman_chart`
========== =================== ================================= ===================================

Mark Property Channels:
Expand All @@ -68,6 +70,7 @@ color :class:`Color` The color of the mark :ref:`gal
fill :class:`Fill` The fill for the mark :ref:`gallery_ridgeline_plot`
fillopacity :class:`FillOpacity` The opacity of the mark's fill N/A
opacity :class:`Opacity` The opacity of the mark :ref:`gallery_horizon_graph`
radius :class:`Radius` The radius or the mark :ref:`gallery_radial_chart`
shape :class:`Shape` The shape of the mark :ref:`gallery_us_incomebrackets_by_state_facet`
size :class:`Size` The size of the mark :ref:`gallery_table_bubble_plot_github`
stroke :class:`Stroke` The stroke of the mark N/A
Expand Down
1 change: 1 addition & 0 deletions doc/user_guide/marks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Altair provides a number of basic mark properties:
========== ============================ =================================================== ====================================
Mark Name Method Description Example
========== ============================ =================================================== ====================================
arc :meth:`~Chart.mark_arc` A pie chart. :ref:`gallery_pie_chart`
area :meth:`~Chart.mark_area` A filled area plot. :ref:`gallery_simple_stacked_area_chart`
bar :meth:`~Chart.mark_bar` A bar plot. :ref:`gallery_simple_bar_chart`
circle :meth:`~Chart.mark_circle` A scatter plot with filled circles. :ref:`gallery_one_dot_per_zipcode`
Expand Down

0 comments on commit 9a365d4

Please sign in to comment.