python - How to display yaxis on both side using matplotlib 0.99? -


i want display yaxis on both side. in matplotlib 1.2, can use following code:

ax.tick_params(labelright = true) 

however, there no method tick_params axes in matplotlib 0.99. there simple way in 0.99? tks

edit got solution followed @brian cain's

ax2 = ax1.twinx() ax2.set_yticks(ax1.get_yticks()) ax2.set_yticklabels([t.get_text() t in ax1.get_yticklabels()]) 

here example matplotlib docs differing scales on each y axis. use same scale if preferred.

import numpy np import matplotlib.pyplot 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-') ax1.set_xlabel('time (s)') # make y-axis label , tick labels match line color. ax1.set_ylabel('exp', color='b') tl in ax1.get_yticklabels():     tl.set_color('b')   ax2 = ax1.twinx() s2 = np.sin(2*np.pi*t) ax2.plot(t, s2, 'r.') ax2.set_ylabel('sin', color='r') tl in ax2.get_yticklabels():     tl.set_color('r') plt.show() 

resulting image


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -