Matthew Auger wrote:
> The GUI plots the x/y position of the cursor in data coordinates using
> scientific notation including only three significant digits (ie
> x=7.24e+03, y=20.2). The scientific notation is annoying but the lack of
> significant digits (ie 7.2457e+03) makes it impossible to fully use the
> GUI for interactive analyses. It would be nice if the cursor position
> denoted by the gui used the same coordinate formatting that the current
> axes use. Thus, if my axes are set to use something like 7.2f formatting
> for values less than 1e5, the cursor coordinate would be displayed in the
> same way (and instead of x=7.24e+03,y=20.1 the gui would read
> x=7245.70,y=20.1 when the cursor is at that coordinate position).
>
> I hope this clears things up!
> Matt
Yes, it does. It looks to me like everything should be controllable
without any hacking. Here is the Axes method that is getting called for
the x-coordinate, for example: (pardon the mailer-mangling of lines)
def format_xdata(self, x):
"""
Return x string formatted. This function will use the attribute
self.fmt_xdata if it is callable, else will fall back on the xaxis
major formatter
"""
try: return self.fmt_xdata(x)
except TypeError:
func = self.xaxis.get_major_formatter().format_data_short
val = func(x)
return val
The reason that the axis formatting is not being followed is because
func = ...format_data_short
instead of format_data (or just the formatter instance itself).
We could change this, but I suspect there is a good reason for choosing
"short" as the default--this is at least open to discussion and
experimentation. In the meantime, if your axes object is ax, you should
be able to do:
ax.fmt_xdata = ax.xaxis.get_major_formatter()
and similarly for the fmt_ydata to make the formatting the same as the
axis formatting. Alternatively you could instantiate whatever Formatter
class you like and set ax.fmt_xdata to that instance.
I haven't tested any of this...
Eric
>
>
>
> On Tue, 20 Feb 2007, Darren Dale wrote:
>
>> On Tuesday 20 February 2007 7:40:18 pm Matthew Auger wrote:
>>> We are starting to use matplotlib to do some analysis of our data, but we
>>> are hampered by the unfortunate choice of significant digits in the GUI.
>>> I hacked the backends for 0.87.7 to display (many) more significant
>>> digits and I was wondering if anyone had any better suggestions (ie that I
>>> could implement directly into my code so others wouldn't need to
>>> continually hack their backends). Perhaps the GUI should follow the
>>> formatting of the axes? (Though this would again require a change to the
>>> backend....)
>> Could you be more specific? In what ways are you currently limited, and how
>> would you like matplotlib to behave?
>>
>> Darren
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users