Skip to content

Commit

Permalink
Categories transposed in data documentation (#3026)
Browse files Browse the repository at this point in the history
In an example column-x is specified as 'quantitative', when it
should be 'nominal'. And column-y is 'nominal', when it should be
'quantitative'.

Co-authored-by: Mattijn van Hoek <mattijn@gmail.com>
  • Loading branch information
m-charlton and mattijn authored Apr 21, 2023
1 parent 3acb5a2 commit 8a66cbe
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions doc/user_guide/data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ There are many different ways of specifying a dataset:
When data is specified as a pandas DataFrame, Altair
uses the data type information provided by pandas to automatically determine
the data types required in the encoding. For example, here we specify data via a pandas DataFrame
and Altair automatically detects that the x-column should be visualized on a quantitative scale
and that the y-column should be visualized on a categorical (nominal) scale:
and Altair automatically detects that the x-column should be visualized on a categorical (nominal) scale
and that the y-column should be visualized on a quantitative scale:

.. altair-plot::

Expand Down Expand Up @@ -349,7 +349,7 @@ GeoDataFrame and visualize these using the ``mark_geoshape``.
gdf_geoms


Since the spatial data in our example is not geographic,
Since the spatial data in our example is not geographic,
we use ``project`` configuration ``type="identity", reflectY=True`` to draw the
geometries without applying a geographic projection. By using ``alt.Color(...).scale(None)`` we
disable the automatic color assignment in Altair
Expand Down Expand Up @@ -486,7 +486,7 @@ TopoJSON File by URL
^^^^^^^^^^^^^^^^^^^^

Altair can load TopoJSON resources directly from a web URL. As
explained in :ref:`spatial-data-inline-topojson`, we have to use the
explained in :ref:`spatial-data-inline-topojson`, we have to use the
``feature`` parameter to specify the object name (here ``boroughs``) and
define the type of data as ``topjoson`` in the ``alt.DataFormat()`` object.

Expand All @@ -496,11 +496,11 @@ define the type of data as ``topjoson`` in the ``alt.DataFormat()`` object.
from vega_datasets import data

url_topojson = data.londonBoroughs.url

data_url_topojson = alt.Data(
url=url_topojson, format=alt.DataFormat(feature="boroughs", type="topojson")
)

data_url_topojson

Note: There also exist a shorthand to extract the objects from a
Expand Down Expand Up @@ -532,22 +532,22 @@ specific regions such as individual countries, states or counties.

Here below we draw the same Boroughs of London, but now as mesh only.

Note: you have to explicitly define ``filled=False`` to draw multi(lines)
Note: you have to explicitly define ``filled=False`` to draw multi(lines)
without fill color.

.. altair-plot::

from vega_datasets import data

url_topojson = data.londonBoroughs.url

data_url_topojson_mesh = alt.Data(
url=url_topojson, format=alt.DataFormat(mesh="boroughs", type="topojson")
)

alt.Chart(data_url_topojson_mesh, title="Border London-Boroughs").mark_geoshape(
filled=False
)
)

.. _spatial-data-nested-geojson:

Expand All @@ -569,9 +569,9 @@ in the list of dictionaries:
{"color": "#A9CDE0", "geo": {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[3.2, 0], [3.2, 1.25], [4.32, 1.25], [4.32, 0], [3.47, 0], [3.2, 0]]]}}},
]
data_nested_features = alt.Data(values=nested_features)

alt.Chart(data_nested_features, title="Vega-Altair").mark_geoshape().encode(
shape="geo:G",
shape="geo:G",
color=alt.Color("color:N").scale(None)
).project(type="identity", reflectY=True)

Expand Down

0 comments on commit 8a66cbe

Please sign in to comment.