matplotlib/matplotlib — pull request #2472 by mdboom (2013-10-01 21:28:29+00:00)
Title: Plots using twinx draw on top of figure frame

While attempting to plot two figures on the same x axis, I noticed that plots were drawing pixels on top of the figure frame. This only seems to happen from Axes derived from a twinx() call. Sample code below should reproduce the problem.

In the image below, the green plot and fill is on top of the frame on the left, bottom, and right.
![overlay](https://f.cloud.github.com/assets/2435101/1231787/1df80c42-2870-11e3-904e-d9f6d38be9b7.png)

Currently using matplotlib 1.3.0 through Anaconda x64 1.9.1 on Windows

import numpy, matplotlib
fig, aAxes = matplotlib.pyplot.subplots(1, 1, figsize = (11, 8.5))

data = numpy.array([[1000, 1100, 1200, 1250, 1300, 1340, 1400, 1500, 1600, 1650, 1700,
1750, 1800, 1804, 1850, 1900, 1910, 1920, 1927, 1930, 1940, 1950,
1960, 1970, 1974, 1980, 1987, 1990, 1999, 2000, 2005, 2007, 2008,
2011],
[ 310, 301, 360, 400, 360, 443, 350, 425, 545, 470, 600,
791, 970, 1000, 1262, 1650, 1750, 1860, 2000, 2070, 2300, 2519,
2982, 3692, 4000, 4435, 5000, 5263, 6000, 6070, 6500, 6576, 6707,
7000]])
LogPop = aAxes
LogPop.set_xlabel('Year')

LinPop = LogPop.twinx()
LinPop.set_ylabel('World Population, Billions')
LogPop.set_ylabel('World Population, Logarithmically Scaled')
LinPop.set_xlim(1000, 2010)
LinPop.set_ylim(0, 8)
LogPop.set_ylim(0.091, 13.3)

LinPop.set_xscale('linear')
LogPop.set_yscale('log', nonposy="clip")

pLogPop, = LogPop.plot(data[0], data[1]/1E3, label = 'Logarithmic', color = '#BEAED4')
fLogPop = LogPop.fill_between(data[0], data[1]/1E3, color = '#BEAED4', alpha=.8)

pLinPop, = LinPop.plot(data[0], data[1]/1E3, label = 'Linear', color = '#7FC97F')
fLinPop = LinPop.fill_between(data[0], data[1]/1E3, color = '#7FC97F', alpha=.5)

assert(LinPop.get_zorder() == LogPop.get_zorder())

LinPop.grid()

aAxes.legend((pLinPop, pLogPop), (pLinPop.get_label(), pLogPop.get_label()), loc=2)