SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Andrew S. <as...@in...> - 2003年10月19日 05:48:13
Sorry to ask for the Nth time, but as essentially all of my plots 
require at least one log10 axis and as matplotlib looks better and 
better, I'm wondering about the status of log axes.
This has even brought me to the point of delving into the innards of 
matplotlib just to see how easy (or hard) it would be. So far, it looks 
possibly like overriding the various Artist.transform_*() methods and 
some additions to axes.py. Is this the case? Would I be duplicating 
effort if I jumped in at this point? I can't tell at this point how 
much work it looks to be -- any estimation?
As a mostly-trivial side-note, while looking through axes.py, I saw a 
few lines like:
 try: ticks.shape
 except AttributeError: ticks = array(ticks)
However, I think "ticks = asarray(ticks)" would be cleaner, and probably 
 little faster, too.
Cheers!
Andrew
From: John H. <jdh...@ac...> - 2003年10月19日 15:01:09
>>>>> "Andrew" == Andrew Straw <as...@in...> writes:
 Andrew> Sorry to ask for the Nth time, but as essentially all of
 Andrew> my plots require at least one log10 axis and as matplotlib
 Andrew> looks better and better, I'm wondering about the status of
 Andrew> log axes.
No need to apologize, pestering is a good thing since it motivates me
to do the things I already want to do when I know people want them.
 Andrew> This has even brought me to the point of delving into the
 Andrew> innards of matplotlib just to see how easy (or hard) it
 Andrew> would be. So far, it looks possibly like overriding the
 Andrew> various Artist.transform_*() methods and some additions to
 Andrew> axes.py. Is this the case? Would I be duplicating effort
 Andrew> if I jumped in at this point? I can't tell at this point
 Andrew> how much work it looks to be -- any estimation?
This is certainly the core change. Other considerations are to get
tick labels to work properly (using exponential or some suitable
notation) and to get the tick locs right (choose them on the decades,
probably using some preset decade choices for the most common use
cases). And the changes need to be consistent with handle graphics,
so that the user can say, for example
 set(gca(), 'xscale', 'log') or
 set(gca(), 'xscale', 'linear) 
and have the desired effect. The latter will happen automagically if
the Axes class defines a set_xscale and set_yscale method expecting
the string arg, which the then forwards the calls to a set_scale
method of the Axes._xaxis or Axes._yaxis instances.
I have been busier than anticipated over the last week so haven't been
able to address this issue as I had hoped, but have been tinkering
with it and thinking about it. If you look at CVS axes class, you'll
see the results of my tickering in the _scale, _scalemap, _scalefunc
attributes of the Axis class. I'm not at all convinced this is the
right design, though. One thing to consider is to factor the tick
loc-ing and labeling into a separate class to clean up the Axis
design.
As far as your helping, that would be great. As far as how much time
it would take, I think it would take me anywhere from half a day to
two days to get it just right, but I'm inclined to the lower
estimates. Let me know how you want to proceed: I can envision
anything from you making the required changes and checking them into
CVS, to us collaborating on the design and implementation, to me just
getting off my ass and doing it. I would certainly welcome some input
from you, and know from the quality of your work on vision egg that it
would improve matplotlib. Which given your impending move to the
Dickinson lab, might be a good thing for you too :-)
 Andrew> However, I think "ticks = asarray(ticks)" would be
 Andrew> cleaner, and probably little faster, too.
Right, I wrote some of the code a long time ago and would do this
differently now. My original thought was that in many of the use
cases the sequences would already be arrays and the try/except thing
would avoid a performance hit of creating a new array, but have since
learned that this is the purpose of asarray. If you decide to do the
log scaling thing, feel free to make these kinds of changes as you
go. The examples dir currently serves as my poor-man's unit testing
framework so you can validate your changes against them. 
Note that I made several minor changes to the code last night so be
sure to grab the latest CVS if you want to do any development.
John
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /