patch: bug with twinx and scientific style

I sent this to the -users list a little over a week ago - now
resending to -devel list against the latest svn.

best,

twinx-scientific-notation.diff (812 Bytes)

···

--
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7

Paul Ivanov, on 2010-12-23 09:47, wrote:

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.

I sent this to the -users list a little over a week ago - now
resending to -devel list against the latest svn.

Paul,

Thanks, I applied your fix to the maintenance branch, so it should appear in the 1.0.1 release that is in the works.

I ran into an unrelated conflict when using svnmerge, so getting it into the trunk will wait until this can be sorted out.

Eric

···

On 01/02/2011 05:03 PM, Paul Ivanov wrote:

best,