Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Categories transposed in data documentation #3026

Merged
merged 2 commits into from
Apr 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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