8000 inconsistent plotting behavier between x coordinate in number and dates · Issue #4339 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
inconsistent plotting behavier between x coordinate in number and dates #4339
Closed
@barpaum

Description

@barpaum

Hi,

I've found an inconsistent behavier for plotting between number coordinate and dates coordiante.
I don't know whether it's easy to fix or it's worthless.
Please see the code below:

Part 1: initialization

from numpy import arange, sin
from matplotlib.pyplot import subplots, show
from matplotlib.dates import num2date
x=arange(0,10,0.1)
t=num2date(x+693596)
y=sin(x)

Part 2: plotting in numbers

fig,ax=subplots()
ax.plot(None,None)
ax.plot(x,y)
show()

Part 3: plotting in dates

fig,ax=subplots()
ax.plot(None,None)
ax.plot(t,y)
show()

Part 1 and Part 2 work well, but Part 3 got error of

matplotlib/dates.py in _to_ordinalf(dt)
    195             dt -= delta
    196 
--> 197     base = float(dt.toordinal())
    198     if hasattr(dt, 'hour'):
    199         base += (dt.hour / HOURS_PER_DAY + dt.minute / MINUTES_PER_DAY +

AttributeError: 'NoneType' object has no attribute 'toordinal'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0