Hi Gary 

To get more control on which grid shows / doesn't, you can do:

ax1.grid('on')
ax2.grid('off') 

instead of: 

plt.grid()

Nico 

On 9/02/2014, at 5:34 pm, matplotlib-users-requ...@lists.sourceforge.net wrote:

> Message: 1
> Date: Sat, 8 Feb 2014 17:29:16 -0800
> From: "garyr" <ga...@fidalgo.net>
> Subject: [Matplotlib-users] twinx and grid
> To: <matplotlib-users@lists.sourceforge.net>
> Message-ID: <4ADC6E5C7E0B41E48913F2C42408B5E6@owner59bf8d40c>
> Content-Type: text/plain; format=flowed; charset="iso-8859-1";
>       reply-type=original
> 
> The script below labels both the left and right x-axes and shows a grid. Is
> there a way to force the horizontal grid lines to line up with the tic marks 
> on
> the left axis (ax1)?
> 
> import numpy as np
> import matplotlib.pyplot as plt
> fig = plt.figure()
> ax1 = fig.add_subplot(111)
> t = np.arange(0.01, 10.0, 0.01)
> s1 = np.exp(t)
> ax1.plot(t, s1, 'b-')
> ax2 = ax1.twinx()
> s2 = np.sin(2*np.pi*t)
> ax2.plot(t, s2, 'r')
> plt.grid()
> plt.show()
> 
> 

--
Dr. Nicolas Fauchereau
Climate Scientist – National Climate Centre
National Institute of Water and Atmospheric Research (NIWA) Ltd.
41 Market Place
Viaduct Precinct, Auckland
NEW ZEALAND
Tel: +64 (0)9 375 2053



------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to