Václav Šmilauer, on 2010-12-23 14:51,  wrote:
> Hi there,
> 
> when I use twinx() to have y1 and y2 axes and set ticklabel_format
> style to 'sci' on the y2 axis, ticks on the y2 are properly numbered,
> but the "1e-5" that is supposed to be atop y2 appears on the top of
> y1 instead. When both y1 and y2 use the exponents, they overwrite
> each other -- a minimal example (result attached in pdf):
> 
> import pylab
> 
> pylab.plot([0,1e-2,2e-2,3e-2],[1e3,5e3,6.1e3,1e3],'g-')
> 
> pylab.ticklabel_format(style='sci',scilimits=(0,0),axis='both')  # this is 
> not necessary to show the bug
> 
> pylab.twinx()
> 
> pylab.plot([1e-2,2e-2,3e-2,4e-2],[2e-5,3e-5,0,-1e-5],'r-')
> 
> pylab.ticklabel_format(style='sci',scilimits=(0,0),axis='both')   # makes 
> 1e-5 appear on the left instead of on the right
> 
> pylab.show()
> 
Hi Václav,

thanks for the bug report. As a temporary workaround - use 

plt.gca().yaxis.set_offset_position('right')

Committers: the patch attached fixes this problem. I thought that
there might be a similar problem for twiny() - but ax.xaxis does
not appear to have .set_offset_position() method.
 
> I've had this issue with versions .99, 1.0.0, running on Linux
> (Ubuntu, versions 9.04 through to 10.10).

me too, and I kept forgetting to report it.

> PS. what's wrong with the sf.net bugzilla? I was not able to post the
> issue there --

this I do not know.

best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
Index: CHANGELOG
===================================================================
--- CHANGELOG	(revision 8845)
+++ CHANGELOG	(working copy)
@@ -1,3 +1,5 @@
+2010-12-23 Fixed twinx scientific notation offset being misplaced
+
 2010-11-22 Fixed error with Hammer projection. - BVR
 
 2010-11-12 Fixed the placement and angle of axis labels in 3D plots. - BVR
Index: lib/matplotlib/axes.py
===================================================================
--- lib/matplotlib/axes.py	(revision 8845)
+++ lib/matplotlib/axes.py	(working copy)
@@ -7391,6 +7391,7 @@
             frameon=False)
         ax2.yaxis.tick_right()
         ax2.yaxis.set_label_position('right')
+        ax2.yaxis.set_offset_position('right')
         self.yaxis.tick_left()
         ax2.xaxis.set_visible(False)
         return ax2
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to