Closed
Description
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)
m.drawstates(zorder=3)
m.contourf(xi, yi, vals, 20, zorder=2)
Thank you!
Metadata
Metadata
Assignees
Labels
No labels