Hi, everyone.

I think I found a couple of bugs, but maybe someone knows something
about this before I go filing a bug report.

Matplotlib version: 1.1.1rc

Bug 1: I'm using axis.twiny() to plot two data sets on top of each other
using a shared y-axis.  If the values are large, an exponent multiplier
appears off to the right of the axis labels. The regular ticklabels for
the second data set are correctly plotted on top of the figure.
However, the exponent does not follow.  Here is an example plot (code is
attached): http://sd-work1.ece.vt.edu/offsettext.png

Bug 2: In trying to come up with a work around for bug 1, I tried to use
the axis.xaxis.get_offset_text().get_text() method to grab the text and
then plot it else where.  However, it returns an empty string when I try
to assign it to a variable.  It will do this until I change the state of
the memory some how, such as creating another figure or dropping to the
debugger.  After that, produces the correct value.  Please see the
attached code, lines 24-33.

Thanks for any help you may have,
Nathaniel
import numpy as np
from matplotlib import pyplot as mp

mp.ion()
yData   = np.arange(500)
xData1  = yData**2
xData2  = yData**3

fig     = mp.figure()
pl=1
ax1     = mp.subplot(111)
mp.plot(xData1,yData)
xfm     = mp.gca().xaxis.get_major_formatter()
xfm.set_powerlimits([ -3, 3])
mp.xlabel('ax1 X-Axis')
mp.ylabel('Shared Y-Axis')

color   = 'r'
ax2     = ax1.twiny()
mp.plot(xData2,yData,color=color)
xfm     = mp.gca().xaxis.get_major_formatter()
xfm.set_powerlimits([ -3, 3])
ax2.set_xlabel('ax2 X-Axis',color=color)
offTxt  = ax2.xaxis.get_offset_text()
offTxt.set_color(color)
ax2.tick_params(axis='x', colors=color)
text    = (offTxt.get_text()) #This one isn't going to work.
print text=='',text #This one returns: True ''

mp.figure() #I generate another figure just because I can.

text    = offTxt.get_text() #After generating the second figure, now this works.
print text=='',text #This one returns: False 1e8
------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to