On Mon, Aug 20, 2012 at 09:13:10AM -0400, Michael Droettboom wrote:
> I've filed an issue for this here:
> 
> https://github.com/matplotlib/matplotlib/issues/1110
>

I think I have sussed out what's going on here.

See PR: https://github.com/matplotlib/matplotlib/pull/1145

Basically, on creating a new Axes object, if a shared axes was passed
in, a copy of the current axes scale is executed. This overwrites the
current formatter.

> 
> Mike
> 
> On 08/19/2012 05:55 PM, Eric Firing wrote:
> >On 2012/08/19 10:31 AM, Christopher Graves wrote:
> >>Hi
> >>
> >>
> >>I do not think this is the expected behavior. First, run the following:
> >>
> >>
> >>from pylab import *
> >>
> >>plot([0,3],[0.2,0.7])
> >>
> >>ax1 = gca()
> >>
> >>ax1.set_yscale('log')
> >>
> >>gca().yaxis.set_major_formatter(FormatStrFormatter('$%g$'))
> >>
> >>#ax2 = ax1.twiny()
> >>
> >>#ax2.set_xlim(ax1.get_xlim())
> >>
> >>show()
> >>
> >>
> >>You will see that the y-axis is log10rithmic and axis labels are 0.1 and
> >>1 rather than 10^-1 and 10^0, due to the use of set_major_formatter().
> >>
> >>
> >>Now uncomment the 2 commented lines and run it again. It seems that upon
> >>applying a twiny(), the set_major_formatter() action is removed and the
> >>y-axis is now displayed as 10^-1 and 10^0. Or more likely, the y-axis is
> >>"overwritten" with a new y-axis present in ax2. One can add another
> >>gca().yaxis.set_major_formatter(FormatStrFormatter('$%g$')) before the
> >>show() and it works as intended. However, it seems like unexpected
> >>behavior to "lose" the formatting when twinning the axis to add a
> >>secondary x-axis. Any advice or agreement that this could be a bug?
> >Yes, I think this is a bug.
> >
> >Eric
> >
> >>
> >>Best,
> >>
> >>Chris
> >>
> >
> >------------------------------------------------------------------------------
> >Live Security Virtual Conference
> >Exclusive live event will cover all the ways today's security and
> >threat landscape has changed and how IT managers can respond. Discussions
> >will include endpoint security, mobile security and the latest in malware
> >threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> >_______________________________________________
> >Matplotlib-users mailing list
> >Matplotlib-users@lists.sourceforge.net
> >https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 

> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-- 
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to