-
Notifications
You must be signed in to change notification settings - Fork 902
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
DOC: Add zorder example to docs #1228
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1228 +/- ##
=======================================
Coverage 89.89% 89.89%
=======================================
Files 21 21
Lines 2088 2088
=======================================
Hits 1877 1877
Misses 211 211 Continue to review full report at Codecov.
|
Hi, cities = geopandas.read_file(geopandas.datasets.get_path('naturalearth_cities'))
world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres')) You don't need to import ax = cities.plot(color='k')
world.plot(ax=ax)
ax = cities.plot(color='k', zorder=2)
world.plot(ax=ax, zorder=1) I would also make a note than lower zorder = lower layer. Thanks! |
Sure...Will do that |
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.
Few minor suggestions, otherwise it looks good. Thanks!
Thanks for helping out : ) |
Co-Authored-By: Martin Fleischmann <36797143+martinfleis@users.noreply.github.com>
Oh, one final thing. You need to tell Control the order of multiple layers in a plot
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When plotting multiple layers, use ``zorder`` to take control of the order of layers being plotted.
The lower the ``zorder`` is, the lower the layer is on the map and vice versa.
Without specified ``zorder``, cities (Points) gets plotted below world (Polygons), following the default order based on geometry types.
.. ipython:: python
ax = cities.plot(color='k')
@savefig zorder_default.png
world.plot(ax=ax);
We can set the ``zorder`` for cities higher than for world to move it of top.
.. ipython:: python
ax = cities.plot(color='k', zorder=2)
@savefig zorder_set.png
world.plot(ax=ax, zorder=1); |
Oh... I have allowed edits from maintainers I will make the change tho... Thank you for your patience |
Thank you @Sangarshanan! |
* Add zorder examples to docs * Remove matplotlib and make suggested changes * Remove empty line * Made the suggested minor changes * Change line format Co-Authored-By: Martin Fleischmann <36797143+martinfleis@users.noreply.github.com> * Save the plots with savefig
Closes #1224