Giter Club home page Giter Club logo

Comments (3)

pelson avatar pelson commented on May 18, 2024

Confirming with:


>>> import matplotlib.pyplot as plt
>>> import matplotlib.dates
>>> import datetime
>>> 
>>> t = datetime.datetime.now().date()
>>> left_varr = range(10)
>>> right_varr = range(10)
>>> right_varr.reverse()
>>> tarr = matplotlib.dates.date2num([t + datetime.timedelta(days=i) for i in right_varr])
>>> fig = plt.figure()
>>> ax1 = fig.add_subplot(1,1,1)
>>> 
>>> ax2 = ax1.twinx()
>>> ax2.plot_date(tarr, right_varr)
[<matplotlib.lines.Line2D object at 0x1025374d0>]
>>> fig.canvas.draw()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/pelson/dev/matplotlib/lib/matplotlib/backends/backend_agg.py", line 433, in draw
    self.figure.draw(self.renderer)
  File "/Users/pelson/dev/matplotlib/lib/matplotlib/artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/Users/pelson/dev/matplotlib/lib/matplotlib/figure.py", line 927, in draw
    func(*args)
  File "/Users/pelson/dev/matplotlib/lib/matplotlib/artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/Users/pelson/dev/matplotlib/lib/matplotlib/axes.py", line 1998, in draw
    a.draw(renderer)
  File "/Users/pelson/dev/matplotlib/lib/matplotlib/artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/Users/pelson/dev/matplotlib/lib/matplotlib/axis.py", line 1047, in draw
    ticks_to_draw = self._update_ticks(renderer)
  File "/Users/pelson/dev/matplotlib/lib/matplotlib/axis.py", line 937, in _update_ticks
    tick_tups = [ t for t in self.iter_ticks()]
  File "/Users/pelson/dev/matplotlib/lib/matplotlib/axis.py", line 884, in iter_ticks
    majorLocs = self.major.locator()
  File "/Users/pelson/dev/matplotlib/lib/matplotlib/dates.py", line 752, in __call__
    self.refresh()
  File "/Users/pelson/dev/matplotlib/lib/matplotlib/dates.py", line 761, in refresh
    dmin, dmax = self.viewlim_to_dt()
  File "/Users/pelson/dev/matplotlib/lib/matplotlib/dates.py", line 533, in viewlim_to_dt
    return num2date(vmin, self.tz), num2date(vmax, self.tz)
  File "/Users/pelson/dev/matplotlib/lib/matplotlib/dates.py", line 292, in num2date
    if not cbook.iterable(x): return _from_ordinalf(x, tz)
  File "/Users/pelson/dev/matplotlib/lib/matplotlib/dates.py", line 206, in _from_ordinalf
    dt = datetime.datetime.fromordinal(ix)
ValueError: ordinal must be >= 1

On master just before the 1.2.x freeze.

from matplotlib.

dmcdougall avatar dmcdougall commented on May 18, 2024

This might be useful.

from matplotlib.

efiring avatar efiring commented on May 18, 2024

It looks like this has been fixed. Using the example above from @pelson, I can't reproduce it with 1.2.x or master. Closing.

from matplotlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.