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

Geoshape docs revamp 5.0 #2699

Merged
merged 27 commits into from
Nov 5, 2022
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8e19225
include geopandas as doc dependency
mattijn Oct 19, 2022
fe0a589
create structure for marks
mattijn Oct 19, 2022
f3cbf5b
include geoshape doc raw
mattijn Oct 19, 2022
16f9be5
classify - refer by url
mattijn Oct 19, 2022
07a29a2
typos and few code updates
mattijn Oct 31, 2022
5547189
Merge branch 'altair-viz:master' into geoshape-docs
mattijn Nov 2, 2022
54e01fa
fix more styling
mattijn Nov 2, 2022
d3394fa
make typo fixes
mattijn Nov 2, 2022
d00f258
enhance styling
mattijn Nov 2, 2022
dffa830
Merge branch 'master' into geoshape-docs
mattijn Nov 4, 2022
d29bddf
Update doc/user_guide/marks/index.rst
mattijn Nov 5, 2022
93e0dc4
Update doc/user_guide/marks/geoshape.rst
mattijn Nov 5, 2022
cbf8be1
Update doc/user_guide/marks/geoshape.rst
mattijn Nov 5, 2022
cd1b613
Update doc/user_guide/marks/geoshape.rst
mattijn Nov 5, 2022
c6fd5e5
Update doc/user_guide/marks/geoshape.rst
mattijn Nov 5, 2022
a06e798
Update doc/user_guide/marks/geoshape.rst
mattijn Nov 5, 2022
da27e86
Update doc/user_guide/marks/geoshape.rst
mattijn Nov 5, 2022
31271ca
Update doc/user_guide/marks/geoshape.rst
mattijn Nov 5, 2022
b636003
Update doc/user_guide/marks/geoshape.rst
mattijn Nov 5, 2022
c3d0e1f
Update doc/user_guide/marks/geoshape.rst
mattijn Nov 5, 2022
d4a0a6b
Update doc/user_guide/marks/geoshape.rst
mattijn Nov 5, 2022
4209eb1
Update doc/user_guide/marks/geoshape.rst
mattijn Nov 5, 2022
de50338
Update doc/user_guide/marks/geoshape.rst
mattijn Nov 5, 2022
86124da
Update doc/user_guide/marks/geoshape.rst
mattijn Nov 5, 2022
e34b4e2
add geoshape to toc
mattijn Nov 5, 2022
fbd6a9d
simplify and improve docs
mattijn Nov 5, 2022
d5a8eba
Merge branch 'master' into geoshape-docs
mattijn Nov 5, 2022
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
Prev Previous commit
Next Next commit
enhance styling
  • Loading branch information
mattijn committed Nov 2, 2022
commit d00f258aa34d3cd6dd0bf114ebdf4bf2e1b87745
26 changes: 12 additions & 14 deletions doc/user_guide/marks/geoshape.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ The following examples applies these approaches to focus on continental Africa:
alt.Chart(gdf_ne).mark_geoshape().project(
type='equalEarth',
scale=200,
translate=[160, 160, 0] # lon, lat, rotation
translate=[160, 160] # lon, lat
)

3. Specify ``fit`` (extent) within the ``project`` method & ``clip=True`` in the mark properties:
Expand Down Expand Up @@ -288,7 +288,8 @@ Chloropleth Classification
Chloropleth maps provide an easy way to visualize how a variable varies across a
geographic area or show the level of variability within a region.

We first define a utility function ``classify()`` that we will use to showcase different approaches to make a chloropleth map:
We first define a utility function ``classify()`` that we will use to showcase different approaches to make a chloropleth map.
We apply it to define a chloropleth map of the unemployment statistics of 2018 of US counties using a ``linear`` scale.

.. altair-plot::

Expand All @@ -302,8 +303,8 @@ We first define a utility function ``classify()`` that we will use to showcase d
width=400
height=300
else:
width=200
height=150
width=180
height=130

# us_counties = gpd.read_file(data.us_10m.url, driver='TopoJSON', layer='counties')
# us_states = gpd.read_file(data.us_10m.url, driver='TopoJSON', layer='states')
Expand Down Expand Up @@ -364,12 +365,7 @@ We first define a utility function ``classify()`` that we will use to showcase d

return (distrib_geoshape + states_geoshape) & distrib_square


Take for example the following example where we define a cholorpleth map of the unemployment statistics of 2018 of US counties using a ``linear`` scale.

.. altair-plot::

classify('linear', size='default')
classify('linear', size='default')


We visualize the unemployment ``rate`` in percentage of 2018 with a ``linear`` scale range
Expand Down Expand Up @@ -537,8 +533,8 @@ will make the following not work for geographic visualization:
color=alt.Color('value:Q'),
facet=alt.Facet('variable:N', columns=3)
).properties(
width=200,
height=200
width=180,
height=130
).resolve_scale('independent')

For now, the following workaround can be adopted to facet a map, manually filter the
Expand All @@ -551,9 +547,11 @@ data in pandas, and create a small multiples chart via concatenation. For exampl
alt.Chart(gdf_comb[gdf_comb.variable == var], title=var)
.mark_geoshape()
.encode(
color="value:Q",
color=alt.Color(
"value:Q", legend=alt.Legend(orient="bottom", direction="horizontal")
)
)
.properties(width=200)
.properties(width=180, height=130)
for var in gdf_comb.variable.unique()
),
columns=3
Expand Down