svn zoom

I fixed that problem in the qt backends by telling the

    > label to ignore sizing hints. We could make the format
    > string shorter, but even then, depending on the size of
    > the window, this problem can occur. What format would you
    > prefer to be reported on the toolbar?

I'm a little confused here because the default should be to use the
axis major formatter (eg in the Axes.format_xdata function). Why
would the default formatter return such a long string?

I don't know what the right answer is: using the default formatter is
usually irritating when plotting dates, since you often want a finer
resolution than you get with the tick formatting (eg if the ticks are
formatted to the nearest day, you may want to see H:M:S when
interacting). Clearly you can override this by using the fmt_xdata
and fmt_ydata attrs, but oftentimes I wish the defaults were better.

As a quick solution, I added a default method to the Formatter base
class

    def format_data_short(self,value):
        'return a short string version'
        return format_data(self,value)

and overrode it for the scalar formatter

    def format_data_short(self,value):
        'return a short formatted string representation of a number'
        return '%1.3g'%value

and used this to format the x and y coords. What do you think about
that (revision 2666)?

JDH

    > I fixed that problem in the qt backends by telling the
    > label to ignore sizing hints. We could make the format
    > string shorter, but even then, depending on the size of
    > the window, this problem can occur. What format would you
    > prefer to be reported on the toolbar?

I'm a little confused here because the default should be to use the
axis major formatter (eg in the Axes.format_xdata function). Why
would the default formatter return such a long string?

I think it is to support for small ranges on top of very large numbers. I
think the fix you suggest below will work for now (I had to make an
additional change to format the offset label correctly, svn 2668), and I can
clean up the default formatter later. I don't want to rush through that.
People have asked for on more than one occassion for engineering notation:
tick labels that read 2x10^-5, they would read 20x10^-6, and I think this
would work with the shorter string formatting.

···

On Thursday 10 August 2006 11:17, John Hunter wrote:

I don't know what the right answer is: using the default formatter is
usually irritating when plotting dates, since you often want a finer
resolution than you get with the tick formatting (eg if the ticks are
formatted to the nearest day, you may want to see H:M:S when
interacting). Clearly you can override this by using the fmt_xdata
and fmt_ydata attrs, but oftentimes I wish the defaults were better.

As a quick solution, I added a default method to the Formatter base
class

    def format_data_short(self,value):
        'return a short string version'
        return format_data(self,value)

and overrode it for the scalar formatter

    def format_data_short(self,value):
        'return a short formatted string representation of a number'
        return '%1.3g'%value

and used this to format the x and y coords. What do you think about
that (revision 2666)?

JDH

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options

I think there is a bug here. Maybe that last line should read

return Formatter.format_data(self,value)

or

return self.format_data(value)

I'm not sure what you had in mind.

···

On Thursday 10 August 2006 11:17, John Hunter wrote:

I'm a little confused here because the default should be to use the
axis major formatter (eg in the Axes.format_xdata function). Why
would the default formatter return such a long string?

I don't know what the right answer is: using the default formatter is
usually irritating when plotting dates, since you often want a finer
resolution than you get with the tick formatting (eg if the ticks are
formatted to the nearest day, you may want to see H:M:S when
interacting). Clearly you can override this by using the fmt_xdata
and fmt_ydata attrs, but oftentimes I wish the defaults were better.

As a quick solution, I added a default method to the Formatter base
class

    def format_data_short(self,value):
        'return a short string version'
        return format_data(self,value)