plot_date problem

I found another issue with plot_date. Dont have a simple example yet, and hope that this is something 'obvious' and I don't have to bother.

I attach two images showing the issue. I can go get rid of the weird scaling in 'bad.png' when I do:

ax.viewLim.intervalx().set_bounds(minXValueImPlotting, maxXValueImPlotting)

after:

ax.autoscale_view()

I also noticed a couple of things inside axes.py, that might be wrong:

1)
    def get_ylim(self):
        "Get the y axis range [ymin, ymax]"
        return self.viewLim.intervalx().get_bounds()

should that intervax() be intervaly() ??

2) panx() and pany() are different as well, but perhaps they should be..

Changin these two things does not fix my problem so it has to be something else - hoping a simple typo. Will try to write a demo script that shows this... (I have matplotlib wrapped into other code so its not really a copy/paste-all type deal).

Peter

John Hunter wrote:

···

"Michael" == Michael Hauser <hauser@...206...> writes:

   > Hello, I am having a problem with plot_date. I keep
   > getting the error:

   > Am I missing something obvious?

No, there is a bug in plot_date in setting the tick formatter object.
I didn't find this in any of my test or example scripts since all
those explicitly set the formatter and hence hid the bug. At the end
of the Axes.plot_date function in matplotlib.axes, replace

       self.xaxis.set_minor_locator(formatter)

with self.xaxis.set_major_formatter(formatter)

and you'll be good to go. Note however that there is a problem with
your script in that the length of your x and y arrays must be the
same. After making the changes above, try

from datetime import datetime
from matplotlib.dates import EpochConverter
from matplotlib.matlab import *

times = [1084195314, 1084195375, 1084195436, 1084195497, 1084195557]
vals = [10.2, 11.1, 8.7, 12.1, 12.2]
converter = EpochConverter()
ax = subplot(111)
plot_date(times, vals, converter)
savefig('test')
show()

-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the
one installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options