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

Right-hand rule polygons not followed with most recent matplotlib versions #24

Open
AugustinMortier opened this issue Dec 4, 2023 · 4 comments

Comments

@AugustinMortier
Copy link

Hello from Norway !
It looks like, since matplotlib 3.8.?, the geojson files computed with geojsoncontour are not always following the right-hand rule. This was probably taken care of by matplotlib before, but recent release notes suggest some "revert contour" deprecation.

@bartromgens
Copy link
Owner

https://pypi.org/project/geojson-rewind/ seems to be able to rewind geojson polygons. Could be used to fix this, or provide tips on how to fix this.

@bertcoerver
Copy link

bertcoerver commented Jul 12, 2024

When using geojsoncontour.contour_to_geojson on contours created by plt.contour from matplotlib>=3.8.0, different isolines (with same values) were connected together for my usecase:

Screenshot 2024-07-12 at 14 20 53

After downgrading to matplotlib==3.7.3, the output from geojsoncontour.contour_to_geojson is normal again:

Screenshot 2024-07-12 at 14 21 10

@maxdow
Copy link

maxdow commented Jul 12, 2024

They are some breaking changes concerning contourf method in the 3.8 release of matplotlib
https://matplotlib.org/stable/api/prev_api_changes/api_changes_3.8.0.html#contourset-is-now-a-single-collection

@toddscottik
Copy link

When using geojsoncontour.contour_to_geojson on contours created by plt.contour from matplotlib>=3.8.0, different isolines (with same values) were connected together for my usecase:

Screenshot 2024-07-12 at 14 20 53 After downgrading to matplotlib==3.7.3, the output from `geojsoncontour.contour_to_geojson` is normal again: Screenshot 2024-07-12 at 14 21 10

I made a fix for it, here is my PR #26
Matplotlib still allows you to have an access to each closed contour in contour.allsegs field, while contour.get_paths() contains a single Path for each level. I understand, there is a room for improvement, maybe it's better to get only one feature for every level instead of one feature for each closed contour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants