Inverting a datetime / plot_date y-axis

Dear all,

I hope some of you could help me out. I am currently trying to generate some timetables using matplotlib.pyplot.plot_date, having the time-axis on the y-axis. Typically, one would like to read these plots from top to bottom, from older to newer items (future on the bottom). Unfortunately, the default enumeration of the y-axis is the other way around, and it resists my attempts to invert its direction e.g. by changing limits using matplotlib.pyplot.ylim (Traceback below). I found a quite old entry in stackoverflow which is most probably outdated, at least the proposed solution did not work for me... (http://stackoverflow.com/questions/5804969/displaying-an-inverted-vertical-date-axis).

Since the longish traceback seems to try to tell me I did not understand some kind of important - even trivial - point about those datetime-axis maybe some of you came about this problem before?

Thanks, Gerd

P.S.: Traceback after trying to use something like "matplotlib.pyplot.ylim(ymax,ymin)":

···

Traceback (most recent call last):
  File "C:\Users\gwellenr\Desktop\Test_Sabine\Plot_csv.py", line 187, in <module>
    matplotlib.pyplot.savefig(save_path+'test.png')
  File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 561, in savefig
    return fig.savefig(*args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\figure.py", line 1421, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\backend_bases.py", line 2220, in print_figure
    **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py", line 505, in print_png
    FigureCanvasAgg.draw(self)
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py", line 451, in draw
    self.figure.draw(self.renderer)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\figure.py", line 1034, in draw
    func(*args)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\axes.py", line 2086, in draw
    a.draw(renderer)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 1091, in draw
    ticks_to_draw = self._update_ticks(renderer)
  File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 945, in _update_ticks
    tick_tups = [t for t in self.iter_ticks()]
  File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 889, in iter_ticks
    majorLocs = self.major.locator()
  File "C:\Python27\lib\site-packages\matplotlib\dates.py", line 802, in __call__
    self.refresh()
  File "C:\Python27\lib\site-packages\matplotlib\dates.py", line 820, in refresh
    self._locator = self.get_locator(dmin, dmax)
  File "C:\Python27\lib\site-packages\matplotlib\dates.py", line 896, in get_locator
    raise ValueError('No sensible date limit could be found in the '
ValueError: No sensible date limit could be found in the AutoDateLocator.

A quick way to do this is ax.invert_yaxis() (and invert_xaxis() for the x-axis). That way you preserve auto-scaling and don’t wind up with manually set axis limits.

What you did should have worked, but ymin and ymax are probably datetime objects. ylim isn’t smart enough to convert them to the datetime units that matplotlib uses internally.

Hope that helps!

-Joe

···

On Tue, Sep 16, 2014 at 4:00 AM, Gerd Wellenreuther <Gerd.Wellenreuther@…4576…> wrote:

Dear all,

I hope some of you could help me out. I am currently trying to generate

some timetables using matplotlib.pyplot.plot_date, having the time-axis

on the y-axis. Typically, one would like to read these plots from top to

bottom, from older to newer items (future on the bottom). Unfortunately,

the default enumeration of the y-axis is the other way around, and it

resists my attempts to invert its direction e.g. by changing limits

using matplotlib.pyplot.ylim (Traceback below). I found a quite old

entry in stackoverflow which is most probably outdated, at least the

proposed solution did not work for me…

(http://stackoverflow.com/questions/5804969/displaying-an-inverted-vertical-date-axis).

Since the longish traceback seems to try to tell me I did not understand

some kind of important - even trivial - point about those datetime-axis

maybe some of you came about this problem before?

Thanks, Gerd

P.S.: Traceback after trying to use something like

“matplotlib.pyplot.ylim(ymax,ymin)”:

Traceback (most recent call last):

File “C:\Users\gwellenr\Desktop\Test_Sabine\Plot_csv.py”, line 187,

in

matplotlib.pyplot.savefig(save_path+'test.png')

File “C:\Python27\lib\site-packages\matplotlib\pyplot.py”, line 561,

in savefig

return fig.savefig(*args, **kwargs)

File “C:\Python27\lib\site-packages\matplotlib\figure.py”, line

1421, in savefig

self.canvas.print_figure(*args, **kwargs)

File “C:\Python27\lib\site-packages\matplotlib\backend_bases.py”,

line 2220, in print_figure

**kwargs)

File

“C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py”,

line 505, in print_png

FigureCanvasAgg.draw(self)

File

“C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py”,

line 451, in draw

self.figure.draw(self.renderer)

File “C:\Python27\lib\site-packages\matplotlib\artist.py”, line 55,

in draw_wrapper

draw(artist, renderer, *args, **kwargs)

File “C:\Python27\lib\site-packages\matplotlib\figure.py”, line

1034, in draw

func(*args)

File “C:\Python27\lib\site-packages\matplotlib\artist.py”, line 55,

in draw_wrapper

draw(artist, renderer, *args, **kwargs)

File “C:\Python27\lib\site-packages\matplotlib\axes.py”, line 2086,

in draw

a.draw(renderer)

File “C:\Python27\lib\site-packages\matplotlib\artist.py”, line 55,

in draw_wrapper

draw(artist, renderer, *args, **kwargs)

File “C:\Python27\lib\site-packages\matplotlib\axis.py”, line 1091,

in draw

ticks_to_draw = self._update_ticks(renderer)

File “C:\Python27\lib\site-packages\matplotlib\axis.py”, line 945,

in _update_ticks

tick_tups = [t for t in self.iter_ticks()]

File “C:\Python27\lib\site-packages\matplotlib\axis.py”, line 889,

in iter_ticks

majorLocs = self.major.locator()

File “C:\Python27\lib\site-packages\matplotlib\dates.py”, line 802,

in call

self.refresh()

File “C:\Python27\lib\site-packages\matplotlib\dates.py”, line 820,

in refresh

self._locator = self.get_locator(dmin, dmax)

File “C:\Python27\lib\site-packages\matplotlib\dates.py”, line 896,

in get_locator

raise ValueError('No sensible date limit could be found in the '

ValueError: No sensible date limit could be found in the AutoDateLocator.


Want excitement?

Manually upgrade your production database.

When you want reliability, choose Perforce.

Perforce version control. Predictably reliable.

http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I would still consider this to be a bug, though. Gerd, could you please file a bug report?

Cheers!

Ben Root

···

On Tue, Sep 16, 2014 at 7:45 AM, Joe Kington <joferkington@…287…> wrote:

A quick way to do this is ax.invert_yaxis() (and invert_xaxis() for the x-axis). That way you preserve auto-scaling and don’t wind up with manually set axis limits.

What you did should have worked, but ymin and ymax are probably datetime objects. ylim isn’t smart enough to convert them to the datetime units that matplotlib uses internally.

Hope that helps!

-Joe


Want excitement?

Manually upgrade your production database.

When you want reliability, choose Perforce.

Perforce version control. Predictably reliable.

http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

On Tue, Sep 16, 2014 at 4:00 AM, Gerd Wellenreuther <Gerd.Wellenreuther@…4576…> wrote:

Dear all,

I hope some of you could help me out. I am currently trying to generate

some timetables using matplotlib.pyplot.plot_date, having the time-axis

on the y-axis. Typically, one would like to read these plots from top to

bottom, from older to newer items (future on the bottom). Unfortunately,

the default enumeration of the y-axis is the other way around, and it

resists my attempts to invert its direction e.g. by changing limits

using matplotlib.pyplot.ylim (Traceback below). I found a quite old

entry in stackoverflow which is most probably outdated, at least the

proposed solution did not work for me…

(http://stackoverflow.com/questions/5804969/displaying-an-inverted-vertical-date-axis).

Since the longish traceback seems to try to tell me I did not understand

some kind of important - even trivial - point about those datetime-axis

maybe some of you came about this problem before?

Thanks, Gerd

P.S.: Traceback after trying to use something like

“matplotlib.pyplot.ylim(ymax,ymin)”:

Traceback (most recent call last):

File “C:\Users\gwellenr\Desktop\Test_Sabine\Plot_csv.py”, line 187,

in

matplotlib.pyplot.savefig(save_path+'test.png')

File “C:\Python27\lib\site-packages\matplotlib\pyplot.py”, line 561,

in savefig

return fig.savefig(*args, **kwargs)

File “C:\Python27\lib\site-packages\matplotlib\figure.py”, line

1421, in savefig

self.canvas.print_figure(*args, **kwargs)

File “C:\Python27\lib\site-packages\matplotlib\backend_bases.py”,

line 2220, in print_figure

**kwargs)

File

“C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py”,

line 505, in print_png

FigureCanvasAgg.draw(self)

File

“C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py”,

line 451, in draw

self.figure.draw(self.renderer)

File “C:\Python27\lib\site-packages\matplotlib\artist.py”, line 55,

in draw_wrapper

draw(artist, renderer, *args, **kwargs)

File “C:\Python27\lib\site-packages\matplotlib\figure.py”, line

1034, in draw

func(*args)

File “C:\Python27\lib\site-packages\matplotlib\artist.py”, line 55,

in draw_wrapper

draw(artist, renderer, *args, **kwargs)

File “C:\Python27\lib\site-packages\matplotlib\axes.py”, line 2086,

in draw

a.draw(renderer)

File “C:\Python27\lib\site-packages\matplotlib\artist.py”, line 55,

in draw_wrapper

draw(artist, renderer, *args, **kwargs)

File “C:\Python27\lib\site-packages\matplotlib\axis.py”, line 1091,

in draw

ticks_to_draw = self._update_ticks(renderer)

File “C:\Python27\lib\site-packages\matplotlib\axis.py”, line 945,

in _update_ticks

tick_tups = [t for t in self.iter_ticks()]

File “C:\Python27\lib\site-packages\matplotlib\axis.py”, line 889,

in iter_ticks

majorLocs = self.major.locator()

File “C:\Python27\lib\site-packages\matplotlib\dates.py”, line 802,

in call

self.refresh()

File “C:\Python27\lib\site-packages\matplotlib\dates.py”, line 820,

in refresh

self._locator = self.get_locator(dmin, dmax)

File “C:\Python27\lib\site-packages\matplotlib\dates.py”, line 896,

in get_locator

raise ValueError('No sensible date limit could be found in the '

ValueError: No sensible date limit could be found in the AutoDateLocator.


Want excitement?

Manually upgrade your production database.

When you want reliability, choose Perforce.

Perforce version control. Predictably reliable.

http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Tried this before, I think, here is the traceback (it is kind of different) - maybe it tells some of you where to look at IF this should really be a bug:

Traceback (most recent call last):
  File "C:\Users\gwellenr\Desktop\Test_Sabine\Plot_csv.py", line 187, in <module>
    matplotlib.pyplot.savefig(save_path+'test.png')
  File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 561, in savefig
    return fig.savefig(*args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\figure.py", line 1421, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\backend_bases.py", line 2220, in print_figure
    **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py", line 505, in print_png
    FigureCanvasAgg.draw(self)
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py", line 451, in draw
    self.figure.draw(self.renderer)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\figure.py", line 1034, in draw
    func(*args)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\axes.py", line 2086, in draw
    a.draw(renderer)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 1091, in draw
    ticks_to_draw = self._update_ticks(renderer)
  File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 945, in _update_ticks
    tick_tups = [t for t in self.iter_ticks()]
  File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 889, in iter_ticks
    majorLocs = self.major.locator()
  File "C:\Python27\lib\site-packages\matplotlib\dates.py", line 802, in __call__
    self.refresh()
  File "C:\Python27\lib\site-packages\matplotlib\dates.py", line 820, in refresh
    self._locator = self.get_locator(dmin, dmax)
  File "C:\Python27\lib\site-packages\matplotlib\dates.py", line 896, in get_locator
    raise ValueError('No sensible date limit could be found in the '
ValueError: No sensible date limit could be found in the AutoDateLocator.

Cheers, Gerd

···

On 16.09.2014 13:45, Joe Kington wrote:

A quick way to do this is ``ax.invert_yaxis()`` (and invert_xaxis() for the x-axis). That way you preserve auto-scaling and don't wind up with manually set axis limits.

What you did should have worked, but ``ymin`` and ``ymax`` are probably datetime objects. ``ylim`` isn't smart enough to convert them to the datetime units that matplotlib uses internally.

Hope that helps!
-Joe

On Tue, Sep 16, 2014 at 4:00 AM, Gerd Wellenreuther > <Gerd.Wellenreuther@…4576… <mailto:Gerd.Wellenreuther@…4576…>> wrote:

    Dear all,

    I hope some of you could help me out. I am currently trying to
    generate
    some timetables using matplotlib.pyplot.plot_date, having the
    time-axis
    on the y-axis. Typically, one would like to read these plots from
    top to
    bottom, from older to newer items (future on the bottom).
    Unfortunately,
    the default enumeration of the y-axis is the other way around, and it
    resists my attempts to invert its direction e.g. by changing limits
    using matplotlib.pyplot.ylim (Traceback below). I found a quite old
    entry in stackoverflow which is most probably outdated, at least the
    proposed solution did not work for me...
    (http://stackoverflow.com/questions/5804969/displaying-an-inverted-vertical-date-axis).

    Since the longish traceback seems to try to tell me I did not
    understand
    some kind of important - even trivial - point about those
    datetime-axis
    maybe some of you came about this problem before?

    Thanks, Gerd

    P.S.: Traceback after trying to use something like
    "matplotlib.pyplot.ylim(ymax,ymin)":
    > Traceback (most recent call last):
    > File "C:\Users\gwellenr\Desktop\Test_Sabine\Plot_csv.py", line
    187,
    > in <module>
    > matplotlib.pyplot.savefig(save_path+'test.png')
    > File "C:\Python27\lib\site-packages\matplotlib\pyplot.py",
    line 561,
    > in savefig
    > return fig.savefig(*args, **kwargs)
    > File "C:\Python27\lib\site-packages\matplotlib\figure.py", line
    > 1421, in savefig
    > self.canvas.print_figure(*args, **kwargs)
    > File "C:\Python27\lib\site-packages\matplotlib\backend_bases.py",
    > line 2220, in print_figure
    > **kwargs)
    > File
    > "C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py",
    > line 505, in print_png
    > FigureCanvasAgg.draw(self)
    > File
    > "C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py",
    > line 451, in draw
    > self.figure.draw(self.renderer)
    > File "C:\Python27\lib\site-packages\matplotlib\artist.py",
    line 55,
    > in draw_wrapper
    > draw(artist, renderer, *args, **kwargs)
    > File "C:\Python27\lib\site-packages\matplotlib\figure.py", line
    > 1034, in draw
    > func(*args)
    > File "C:\Python27\lib\site-packages\matplotlib\artist.py",
    line 55,
    > in draw_wrapper
    > draw(artist, renderer, *args, **kwargs)
    > File "C:\Python27\lib\site-packages\matplotlib\axes.py", line
    2086,
    > in draw
    > a.draw(renderer)
    > File "C:\Python27\lib\site-packages\matplotlib\artist.py",
    line 55,
    > in draw_wrapper
    > draw(artist, renderer, *args, **kwargs)
    > File "C:\Python27\lib\site-packages\matplotlib\axis.py", line
    1091,
    > in draw
    > ticks_to_draw = self._update_ticks(renderer)
    > File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 945,
    > in _update_ticks
    > tick_tups = [t for t in self.iter_ticks()]
    > File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 889,
    > in iter_ticks
    > majorLocs = self.major.locator()
    > File "C:\Python27\lib\site-packages\matplotlib\dates.py", line
    802,
    > in __call__
    > self.refresh()
    > File "C:\Python27\lib\site-packages\matplotlib\dates.py", line
    820,
    > in refresh
    > self._locator = self.get_locator(dmin, dmax)
    > File "C:\Python27\lib\site-packages\matplotlib\dates.py", line
    896,
    > in get_locator
    > raise ValueError('No sensible date limit could be found in the '
    > ValueError: No sensible date limit could be found in the
    AutoDateLocator.

    ------------------------------------------------------------------------------
    Want excitement?
    Manually upgrade your production database.
    When you want reliability, choose Perforce.
    Perforce version control. Predictably reliable.
    http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
    _______________________________________________
    Matplotlib-users mailing list
    Matplotlib-users@lists.sourceforge.net
    <mailto:Matplotlib-users@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Perhaps something is odd with the date values you have? Can you make an SSCCE (sscce.org)that demonstrates the problem? There is definitely some sort of bug at play here.

Cheers!

Ben Root

···

On Tue, Sep 16, 2014 at 9:20 AM, Gerd Wellenreuther <Gerd.Wellenreuther@…4576…> wrote:

  Tried this before, I think, here is the

traceback (it is kind of different) - maybe it tells some of you
where to look at IF this should really be a bug:

Traceback (most recent call last):

      File "C:\Users\gwellenr\Desktop\Test_Sabine\Plot_csv.py", line

187, in

        matplotlib.pyplot.savefig(save_path+'test.png')

      File "C:\Python27\lib\site-packages\matplotlib\pyplot.py",

line 561, in savefig

        return fig.savefig(*args, **kwargs)

      File "C:\Python27\lib\site-packages\matplotlib\figure.py",

line 1421, in savefig

        self.canvas.print_figure(*args, **kwargs)

      File

“C:\Python27\lib\site-packages\matplotlib\backend_bases.py”,
line 2220, in print_figure

        **kwargs)

      File

“C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py”,
line 505, in print_png

        FigureCanvasAgg.draw(self)

      File

“C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py”,
line 451, in draw

        self.figure.draw(self.renderer)

      File "C:\Python27\lib\site-packages\matplotlib\artist.py",

line 55, in draw_wrapper

        draw(artist, renderer, *args, **kwargs)

      File "C:\Python27\lib\site-packages\matplotlib\figure.py",

line 1034, in draw

        func(*args)

      File "C:\Python27\lib\site-packages\matplotlib\artist.py",

line 55, in draw_wrapper

        draw(artist, renderer, *args, **kwargs)

      File "C:\Python27\lib\site-packages\matplotlib\axes.py", line

2086, in draw

        a.draw(renderer)

      File "C:\Python27\lib\site-packages\matplotlib\artist.py",

line 55, in draw_wrapper

        draw(artist, renderer, *args, **kwargs)

      File "C:\Python27\lib\site-packages\matplotlib\axis.py", line

1091, in draw

        ticks_to_draw = self._update_ticks(renderer)

      File "C:\Python27\lib\site-packages\matplotlib\axis.py", line

945, in _update_ticks

        tick_tups = [t for t in self.iter_ticks()]

      File "C:\Python27\lib\site-packages\matplotlib\axis.py", line

889, in iter_ticks

        majorLocs = self.major.locator()

      File "C:\Python27\lib\site-packages\matplotlib\dates.py", line

802, in call

        self.refresh()

      File "C:\Python27\lib\site-packages\matplotlib\dates.py", line

820, in refresh

        self._locator = self.get_locator(dmin, dmax)

      File "C:\Python27\lib\site-packages\matplotlib\dates.py", line

896, in get_locator

        raise ValueError('No sensible date limit could be found in

the ’

    ValueError: No sensible date limit could be found in the

AutoDateLocator.

Cheers, Gerd

  On 16.09.2014 13:45, Joe Kington wrote:
      A quick way to do this is ``ax.invert_yaxis()``  (and

invert_xaxis() for the x-axis). That way you preserve
auto-scaling and don’t wind up with manually set axis limits.

      What you did should have worked, but ``ymin`` and ``ymax`` are

probably datetime objects. ylim isn’t smart enough to
convert them to the datetime units that matplotlib uses
internally.

      Hope that helps!

-Joe


Want excitement?

Manually upgrade your production database.

When you want reliability, choose Perforce.

Perforce version control. Predictably reliable.

http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

      On Tue, Sep 16, 2014 at 4:00 AM, Gerd

Wellenreuther <Gerd.Wellenreuther@…4576…>
wrote:

Dear all,

        I hope some of you could help me out. I am currently trying

to generate

        some timetables using matplotlib.pyplot.plot_date, having

the time-axis

        on the y-axis. Typically, one would like to read these plots

from top to

        bottom, from older to newer items (future on the bottom).

Unfortunately,

        the default enumeration of the y-axis is the other way

around, and it

        resists my attempts to invert its direction e.g. by changing

limits

        using matplotlib.pyplot.ylim (Traceback below). I found a

quite old

        entry in stackoverflow which is most probably outdated, at

least the

        proposed solution did not work for me...

        ([http://stackoverflow.com/questions/5804969/displaying-an-inverted-vertical-date-axis](http://stackoverflow.com/questions/5804969/displaying-an-inverted-vertical-date-axis)).



        Since the longish traceback seems to try to tell me I did

not understand

        some kind of important - even trivial - point about those

datetime-axis

        maybe some of you came about this problem before?



        Thanks, Gerd



        P.S.: Traceback after trying to use something like

        "matplotlib.pyplot.ylim(ymax,ymin)":

        > Traceback (most recent call last):

        >   File

“C:\Users\gwellenr\Desktop\Test_Sabine\Plot_csv.py”, line
187,

        > in <module>

        >     matplotlib.pyplot.savefig(save_path+'test.png')

        >   File

“C:\Python27\lib\site-packages\matplotlib\pyplot.py”, line
561,

        > in savefig

        >     return fig.savefig(*args, **kwargs)

        >   File

“C:\Python27\lib\site-packages\matplotlib\figure.py”, line

        > 1421, in savefig

        >     self.canvas.print_figure(*args, **kwargs)

        >   File

“C:\Python27\lib\site-packages\matplotlib\backend_bases.py”,

        > line 2220, in print_figure

        >     **kwargs)

        >   File

        >

“C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py”,

        > line 505, in print_png

        >     FigureCanvasAgg.draw(self)

        >   File

        >

“C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py”,

        > line 451, in draw

        >     self.figure.draw(self.renderer)

        >   File

“C:\Python27\lib\site-packages\matplotlib\artist.py”, line
55,

        > in draw_wrapper

        >     draw(artist, renderer, *args, **kwargs)

        >   File

“C:\Python27\lib\site-packages\matplotlib\figure.py”, line

        > 1034, in draw

        >     func(*args)

        >   File

“C:\Python27\lib\site-packages\matplotlib\artist.py”, line
55,

        > in draw_wrapper

        >     draw(artist, renderer, *args, **kwargs)

        >   File

“C:\Python27\lib\site-packages\matplotlib\axes.py”, line
2086,

        > in draw

        >     a.draw(renderer)

        >   File

“C:\Python27\lib\site-packages\matplotlib\artist.py”, line
55,

        > in draw_wrapper

        >     draw(artist, renderer, *args, **kwargs)

        >   File

“C:\Python27\lib\site-packages\matplotlib\axis.py”, line
1091,

        > in draw

        >     ticks_to_draw = self._update_ticks(renderer)

        >   File

“C:\Python27\lib\site-packages\matplotlib\axis.py”, line
945,

        > in _update_ticks

        >     tick_tups = [t for t in self.iter_ticks()]

        >   File

“C:\Python27\lib\site-packages\matplotlib\axis.py”, line
889,

        > in iter_ticks

        >     majorLocs = self.major.locator()

        >   File

“C:\Python27\lib\site-packages\matplotlib\dates.py”, line
802,

        > in __call__

        >     self.refresh()

        >   File

“C:\Python27\lib\site-packages\matplotlib\dates.py”, line
820,

        > in refresh

        >     self._locator = self.get_locator(dmin, dmax)

        >   File

“C:\Python27\lib\site-packages\matplotlib\dates.py”, line
896,

        > in get_locator

        >     raise ValueError('No sensible date limit could be

found in the ’

        > ValueError: No sensible date limit could be found in

the AutoDateLocator.


        Want excitement?

        Manually upgrade your production database.

        When you want reliability, choose Perforce.

        Perforce version control. Predictably reliable.

        [http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk](http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk)

        _______________________________________________

        Matplotlib-users mailing list

        Matplotlib-users@lists.sourceforge.net

        [https://lists.sourceforge.net/lists/listinfo/matplotlib-users](https://lists.sourceforge.net/lists/listinfo/matplotlib-users)

Just posted some small code under https://github.com/matplotlib/matplotlib/issues/3522

I guess the formatting is not up to standards, but I did not find another way to attach the code...

Cheers, Gerd

···

On 16.09.2014 15:29, Benjamin Root wrote:

Perhaps something is odd with the date values you have? Can you make an SSCCE (sscce.org <http://sscce.org>)that demonstrates the problem? There is definitely some sort of bug at play here.

Cheers!
Ben Root

On Tue, Sep 16, 2014 at 9:20 AM, Gerd Wellenreuther > <Gerd.Wellenreuther@…4576… <mailto:Gerd.Wellenreuther@…4576…>> wrote:

    Tried this before, I think, here is the traceback (it is kind of
    different) - maybe it tells some of you where to look at IF this
    should really be a bug:

    Traceback (most recent call last):
      File "C:\Users\gwellenr\Desktop\Test_Sabine\Plot_csv.py", line
    187, in <module>
    matplotlib.pyplot.savefig(save_path+'test.png')
      File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line
    561, in savefig
        return fig.savefig(*args, **kwargs)
      File "C:\Python27\lib\site-packages\matplotlib\figure.py", line
    1421, in savefig
        self.canvas.print_figure(*args, **kwargs)
      File
    "C:\Python27\lib\site-packages\matplotlib\backend_bases.py", line
    2220, in print_figure
        **kwargs)
      File
    "C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py",
    line 505, in print_png
        FigureCanvasAgg.draw(self)
      File
    "C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py",
    line 451, in draw
        self.figure.draw(self.renderer)
      File "C:\Python27\lib\site-packages\matplotlib\artist.py", line
    55, in draw_wrapper
        draw(artist, renderer, *args, **kwargs)
      File "C:\Python27\lib\site-packages\matplotlib\figure.py", line
    1034, in draw
        func(*args)
      File "C:\Python27\lib\site-packages\matplotlib\artist.py", line
    55, in draw_wrapper
        draw(artist, renderer, *args, **kwargs)
      File "C:\Python27\lib\site-packages\matplotlib\axes.py", line
    2086, in draw
        a.draw(renderer)
      File "C:\Python27\lib\site-packages\matplotlib\artist.py", line
    55, in draw_wrapper
        draw(artist, renderer, *args, **kwargs)
      File "C:\Python27\lib\site-packages\matplotlib\axis.py", line
    1091, in draw
        ticks_to_draw = self._update_ticks(renderer)
      File "C:\Python27\lib\site-packages\matplotlib\axis.py", line
    945, in _update_ticks
        tick_tups = [t for t in self.iter_ticks()]
      File "C:\Python27\lib\site-packages\matplotlib\axis.py", line
    889, in iter_ticks
        majorLocs = self.major.locator()
      File "C:\Python27\lib\site-packages\matplotlib\dates.py", line
    802, in __call__
        self.refresh()
      File "C:\Python27\lib\site-packages\matplotlib\dates.py", line
    820, in refresh
        self._locator = self.get_locator(dmin, dmax)
      File "C:\Python27\lib\site-packages\matplotlib\dates.py", line
    896, in get_locator
        raise ValueError('No sensible date limit could be found in the '
    ValueError: No sensible date limit could be found in the
    AutoDateLocator.

    Cheers, Gerd

    On 16.09.2014 13:45, Joe Kington wrote:

    A quick way to do this is ``ax.invert_yaxis()`` (and
    invert_xaxis() for the x-axis). That way you preserve
    auto-scaling and don't wind up with manually set axis limits.

    What you did should have worked, but ``ymin`` and ``ymax`` are
    probably datetime objects. ``ylim`` isn't smart enough to convert
    them to the datetime units that matplotlib uses internally.

    Hope that helps!
    -Joe

    On Tue, Sep 16, 2014 at 4:00 AM, Gerd Wellenreuther >> <Gerd.Wellenreuther@…4576… <mailto:Gerd.Wellenreuther@…4576…>> >> wrote:

        Dear all,

        I hope some of you could help me out. I am currently trying
        to generate
        some timetables using matplotlib.pyplot.plot_date, having the
        time-axis
        on the y-axis. Typically, one would like to read these plots
        from top to
        bottom, from older to newer items (future on the bottom).
        Unfortunately,
        the default enumeration of the y-axis is the other way
        around, and it
        resists my attempts to invert its direction e.g. by changing
        limits
        using matplotlib.pyplot.ylim (Traceback below). I found a
        quite old
        entry in stackoverflow which is most probably outdated, at
        least the
        proposed solution did not work for me...
        (http://stackoverflow.com/questions/5804969/displaying-an-inverted-vertical-date-axis).

        Since the longish traceback seems to try to tell me I did not
        understand
        some kind of important - even trivial - point about those
        datetime-axis
        maybe some of you came about this problem before?

        Thanks, Gerd

        P.S.: Traceback after trying to use something like
        "matplotlib.pyplot.ylim(ymax,ymin)":
        > Traceback (most recent call last):
        > File "C:\Users\gwellenr\Desktop\Test_Sabine\Plot_csv.py",
        line 187,
        > in <module>
        > matplotlib.pyplot.savefig(save_path+'test.png')
        > File
        "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 561,
        > in savefig
        > return fig.savefig(*args, **kwargs)
        > File
        "C:\Python27\lib\site-packages\matplotlib\figure.py", line
        > 1421, in savefig
        > self.canvas.print_figure(*args, **kwargs)
        > File
        "C:\Python27\lib\site-packages\matplotlib\backend_bases.py",
        > line 2220, in print_figure
        > **kwargs)
        > File
        >
        "C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py",
        > line 505, in print_png
        > FigureCanvasAgg.draw(self)
        > File
        >
        "C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py",
        > line 451, in draw
        > self.figure.draw(self.renderer)
        > File
        "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55,
        > in draw_wrapper
        > draw(artist, renderer, *args, **kwargs)
        > File
        "C:\Python27\lib\site-packages\matplotlib\figure.py", line
        > 1034, in draw
        > func(*args)
        > File
        "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55,
        > in draw_wrapper
        > draw(artist, renderer, *args, **kwargs)
        > File "C:\Python27\lib\site-packages\matplotlib\axes.py",
        line 2086,
        > in draw
        > a.draw(renderer)
        > File
        "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55,
        > in draw_wrapper
        > draw(artist, renderer, *args, **kwargs)
        > File "C:\Python27\lib\site-packages\matplotlib\axis.py",
        line 1091,
        > in draw
        > ticks_to_draw = self._update_ticks(renderer)
        > File "C:\Python27\lib\site-packages\matplotlib\axis.py",
        line 945,
        > in _update_ticks
        > tick_tups = [t for t in self.iter_ticks()]
        > File "C:\Python27\lib\site-packages\matplotlib\axis.py",
        line 889,
        > in iter_ticks
        > majorLocs = self.major.locator()
        > File "C:\Python27\lib\site-packages\matplotlib\dates.py",
        line 802,
        > in __call__
        > self.refresh()
        > File "C:\Python27\lib\site-packages\matplotlib\dates.py",
        line 820,
        > in refresh
        > self._locator = self.get_locator(dmin, dmax)
        > File "C:\Python27\lib\site-packages\matplotlib\dates.py",
        line 896,
        > in get_locator
        > raise ValueError('No sensible date limit could be found
        in the '
        > ValueError: No sensible date limit could be found in the
        AutoDateLocator.

        ------------------------------------------------------------------------------
        Want excitement?
        Manually upgrade your production database.
        When you want reliability, choose Perforce.
        Perforce version control. Predictably reliable.
        http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
        _______________________________________________
        Matplotlib-users mailing list
        Matplotlib-users@lists.sourceforge.net
        <mailto:Matplotlib-users@lists.sourceforge.net>
        https://lists.sourceforge.net/lists/listinfo/matplotlib-users

    ------------------------------------------------------------------------------
    Want excitement?
    Manually upgrade your production database.
    When you want reliability, choose Perforce.
    Perforce version control. Predictably reliable.
    http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
    _______________________________________________
    Matplotlib-users mailing list
    Matplotlib-users@lists.sourceforge.net
    <mailto:Matplotlib-users@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/matplotlib-users