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

Update the gallery example for plotting lines with LineString/MultiLineString geometry #3711

Merged
merged 25 commits into from
Dec 31, 2024

Conversation

michaelgrund
Copy link
Member

@michaelgrund michaelgrund commented Dec 24, 2024

Description of proposed changes

Fixes #3320

Preview: https://pygmt-dev--3711.org.readthedocs.build/en/3711/gallery/lines/linestrings.html#

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.
  • Use underscores (not hyphens) in names of Python files and directories.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash command is:

  • /format: automatically format and lint the code

@michaelgrund michaelgrund added the documentation Improvements or additions to documentation label Dec 24, 2024
@michaelgrund michaelgrund added this to the 0.14.0 milestone Dec 24, 2024
@michaelgrund michaelgrund marked this pull request as draft December 24, 2024 14:46
@seisman
Copy link
Member

seisman commented Dec 25, 2024

Two thoughts:

  1. Perhaps we should have geodatasets installed in our CI, so that we don't have to have the long URL hardcoded.
  2. The title "Rivers" gives me the expression that this is about a river dataset, but actually it's all about plotting LineString/MultiLineString geometries in GeoPandas objects (or geojson format). Maybe rename the title to something like "Plotting lines with LineString/MultiLineString geometry", "GeoPandas: Lines with LineString/MultiLineString geometry"

@michaelgrund
Copy link
Member Author

Two thoughts:

1. Perhaps we should have [`geodatasets`](https://github.com/geopandas/geodatasets) installed in our CI, so that we don't have to have the long URL hardcoded.

2. The title "Rivers" gives me the expression that this is about a river dataset, but actually it's all about plotting LineString/MultiLineString geometries in GeoPandas objects (or geojson format). Maybe rename the title to something like "Plotting lines with LineString/MultiLineString geometry", "GeoPandas: Lines with LineString/MultiLineString geometry"

Agree with both points. Regarding point 1 we just want to add it for the docs/gallery example and not as an general dependency, right?

@seisman
Copy link
Member

seisman commented Dec 25, 2024

Two thoughts:

1. Perhaps we should have [`geodatasets`](https://github.com/geopandas/geodatasets) installed in our CI, so that we don't have to have the long URL hardcoded.

2. The title "Rivers" gives me the expression that this is about a river dataset, but actually it's all about plotting LineString/MultiLineString geometries in GeoPandas objects (or geojson format). Maybe rename the title to something like "Plotting lines with LineString/MultiLineString geometry", "GeoPandas: Lines with LineString/MultiLineString geometry"

Agree with both points. Regarding point 1 we just want to add it for the docs/gallery example and not as an general dependency, right?

Yes.

@yvonnefroehlich
Copy link
Member

Regarding point 1, this would be also relevant / helpful for the Gallery example Choropleth map.

@seisman
Copy link
Member

seisman commented Dec 25, 2024

Regarding point 1, this would be also relevant / helpful for the Gallery example Choropleth map.

Maybe we should add geodatasets and update the Choropleth example in a separate PR first.

@seisman
Copy link
Member

seisman commented Dec 25, 2024

Regarding point 1, this would be also relevant / helpful for the Gallery example Choropleth map.

Maybe we should add geodatasets and update the Choropleth example in a separate PR first.

I'll open a PR in minites.

examples/gallery/lines/linestrings.py Outdated Show resolved Hide resolved
examples/gallery/lines/linestrings.py Outdated Show resolved Hide resolved
@michaelgrund
Copy link
Member Author

/format

examples/gallery/lines/linestrings.py Outdated Show resolved Hide resolved
examples/gallery/lines/linestrings.py Outdated Show resolved Hide resolved
@@ -0,0 +1,39 @@
"""
Plotting lines with LineString/MultiLineString geometry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if it makes more sense to change the title to:

GeoPandas: Plotting lines with LineString/MultiLineString geometry


The :meth:`pygmt.Figure.plot` method allows us to plot geographical data such
as lines which are stored in a :class:`geopandas.GeoDataFrame` object. Use
:func:`geopandas.read_file` to load data from any supported OGR format such as
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:func:`geopandas.read_file` to load data from any supported OGR format such as
:func:`geopandas.read_file` to load data from any supported OGR formats such as

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think format is correct here.

examples/gallery/lines/linestrings.py Outdated Show resolved Hide resolved
examples/gallery/lines/linestrings.py Show resolved Hide resolved
@seisman seisman mentioned this pull request Dec 27, 2024
49 tasks
examples/gallery/lines/linestrings.py Outdated Show resolved Hide resolved
examples/gallery/lines/linestrings.py Outdated Show resolved Hide resolved
examples/gallery/lines/linestrings.py Outdated Show resolved Hide resolved
examples/gallery/lines/linestrings.py Outdated Show resolved Hide resolved
@seisman seisman changed the title Update gpd lines gallery example Update the gallery example for plotting lines with LineString/MultiLineString geometry Dec 31, 2024
@seisman
Copy link
Member

seisman commented Dec 31, 2024

I've committed the suggestion @yvonnefroehlich and I made, so that this PR can be merged in v0.14.0.

seisman added a commit that referenced this pull request Dec 31, 2024
@seisman seisman merged commit 32cc7a2 into main Dec 31, 2024
9 of 10 checks passed
@seisman seisman deleted the upd-gpd-lines-gallery branch December 31, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use a different dataset in the gallery example "examples/gallery/lines/roads.py"
4 participants