Hi Paul,

I've modified your suggestion a little, since I don't want a grid for the
primary axis at all -- unfortunately to no avail, i.e. no grid line at all:

import numpy

import matplotlib

matplotlib.use('agg')

import matplotlib.pyplot as plt


datax = numpy.arange(50)

data1 = numpy.sin(datax)*1.5

data2 = datax**2


plt.close('all')


fig = plt.figure()

ax1 = fig.add_subplot(111)

ax2 = ax1.twinx()


ax1.plot(datax, data1, 'x')

ax2.plot(datax, data2, '--')


#for ax in [ax1, ax2]:

# ax.xaxis.grid(True, which='both') # `which` can be 'minor', 'major', or
'both'

# ax.yaxis.grid(True, which='both')


ax2.xaxis.grid(True, which='both')

ax2.yaxis.grid(True, which='both')


fig.savefig('twinxgrid.png')

#fig.show()
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to