Thanks to visit codestin.com
Credit goes to github.com

Skip to content

zorder failure with matplotlib 2.0.0 and current basemap master #333

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

Closed
akrherz opened this issue Jan 18, 2017 · 4 comments
Closed

zorder failure with matplotlib 2.0.0 and current basemap master #333

akrherz opened this issue Jan 18, 2017 · 4 comments

Comments

@akrherz
Copy link
Contributor

akrherz commented Jan 18, 2017

Previously, I was able to set a zorder=3 on things like drawstates() and then later run contourf() with a zorder=2 and the plot would appear correctly. For example:

import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import numpy as np
from scipy.interpolate import NearestNDInterpolator

m = Basemap(llcrnrlon=-100, llcrnrlat=38,
            urcrnrlon=-86, urcrnrlat=46)

m.drawstates()

lons = np.arange(-110, -80, 1)
lats = np.arange(30, 60, 1)
vals = np.arange(30)
xi = np.linspace(-120, -60, 100)
yi = np.linspace(23, 50, 100)
xi, yi = np.meshgrid(xi, yi)
nn = NearestNDInterpolator((lons, lats), vals)
vals = nn(xi, yi)
m.drawstates(zorder=3)
m.contourf(xi, yi, vals, 20, zorder=2)
plt.savefig('test.png')

This code appears to work on matplotlib 1.5.3 and 2.0.0 with a master build from approximately 24 Oct 2016. As I try current basemap master build with matplotlib 2.0.0, it fails. Failing meaning that the contourf appears overtop the states. For example:

m.contourf(xi, yi, vals, 20, zorder=2)
m.drawstates(zorder=3)

test

m.drawstates(zorder=3)
m.contourf(xi, yi, vals, 20, zorder=2)

bad

Thank you!

@akrherz
Copy link
Contributor Author

akrherz commented Jan 18, 2017

I have isolated the problem to recent changes done with ax._hold. I have no experience with _hold, but will look further into it.

@WeatherGod
Copy link
Member

WeatherGod commented Jan 18, 2017 via email

akrherz added a commit to akrherz/basemap that referenced this issue Jan 18, 2017
@akrherz
Copy link
Contributor Author

akrherz commented Jan 18, 2017

submitted PR with what appears to fix my issue, but I am not fully certain if this works with matplotlib < 2, sorry.

WeatherGod added a commit that referenced this issue Jan 18, 2017
@WeatherGod
Copy link
Member

closed by #334

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

2 participants