Skip to content

zorder failure with matplotlib 2.0.0 and current basemap master #333

Closed
@akrherz

Description

@akrherz

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions