-
Notifications
You must be signed in to change notification settings - Fork 219
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
Add gallery example showing usage of line objects from a geopandas.GeoDataFrame #1474
Conversation
…s.GeoDataFrame Here's the first gallery example showcasing how to plot line objects stored in a geopandas.GeoDataFrame.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @michaelgrund! This geopandas
example will be a nice addition to the gallery 😁
To fix the failing CI docs test, you'll need to add geopandas
as a dependency at
pygmt/.github/workflows/ci_docs.yml
Lines 69 to 70 in 16bc8ab
conda install gmt=6.2.0 numpy pandas xarray netCDF4 packaging \ | |
ipython make myst-parser \ |
Related to #1474, this PR adds the geopandas library as a dependency in the CI docs test.
Added in #1481. |
Co-authored-by: Wei Ji <[email protected]>
Unrelated test failure due to setuptools_scm v6.3.0 having some error about missing tomli (see pypa/setuptools-scm#608). They've released v6.3.1 so should be all good now, restarting tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two more comments from me, otherwise ready for final review. Will give it until the end of the week (Friday 10/9/2021) since it's a public holiday in the US.
examples/gallery/maps/roads.py
Outdated
fig.basemap( | ||
region=region, | ||
projection="M12c", | ||
frame=["af", 'WSne+t"Main roads of Oahu (Hawaii)"'], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've figured it out! We can use the octal code for apostrophe (') which is 047, see https://docs.generic-mapping-tools.org/6.2/cookbook/octal-codes.html.
fig.basemap( | |
region=region, | |
projection="M12c", | |
frame=["af", 'WSne+t"Main roads of Oahu (Hawaii)"'], | |
) | |
title = r"Main roads of O\047ahu (Hawai\047i)" # \047 is octal code for ' | |
fig.basemap(region=region, projection="M12c", frame=["af", f'WSne+t"{title}"']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great @weiji14!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realizing two years later that I used the wrong symbol 😅 It should be an Okina ʻ
(U+02BB) instead of an apostrophe. Looks more like a 6 than a 9.
Co-authored-by: Wei Ji <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example looks good to me, but I'm not sure if we should put the example in the "Maps and map elements" or the "Lines and vectors" category.
Co-authored-by: Dongdong Tian <[email protected]>
Of course, we should definitely discuss that before merging. Would be happy with both categories since the example contains elements that would fit into both. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
I prefer to have this example in the "Lines and vectors" category, because the example focuses on plotting lines from GeoDataFrame, rather than plotting a map. |
Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
…oDataFrame (GenericMappingTools#1474) Co-authored-by: Wei Ji <[email protected]> Co-authored-by: Dongdong Tian <[email protected]>
Description of proposed changes
Here's the first gallery example showcasing how to plot line objects stored in a geopandas.GeoDataFrame (see #1374).
Preview at https://pygmt-git-gallery-gpd-lines-gmt.vercel.app/gallery/maps/roads.html
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version