{{ message }}
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two objections:
Despite the superficial and subject matter similarities, I'm not convinced that
timedeltais necessarily best handled indates.py. Date-time instances are complicated because their natural domain is a line in a non-decimal, often non-monotonic number system with complicated unit system.timedeltaspecifically, because it only handles durations whose length is invariant with translation along the number line, is effectively a convenience wrapper around an integer number of seconds, with almost none of the complexity ofdatetimes. If there's a general units framework, I thinktimedeltalikely fits in there much better than lumping it in withdates.py. I'm open to being convinced thattimedeltaworks best indates.pyIt's not clear to me why the base unit for this is ordinal days. They don't really need to be compatible with how datetimes are handled, and the more natural base unit would be some unit like seconds, microseconds, nanoseconds, etc.
np.timedelta64has some complicated unit behavior, but the base type seems to be microseconds.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this has to be this way in order to be compatible with how we handle datetimes; the base unit has to the be the same if e.g. I want to plot something that has a
timedeltawidth on adatetimeaxis.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dstansby I think the question of having a
timedeltawidth on adatetimeaxis was solved by #9072. That's very different from plotting atimedeltaon adatetimeaxis.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem has come up again in #11290 - I see no reason to use ordinal days - we have to use something, and using ordinal days would make our lives much easier with respect to plotting widths/heights on datetime axes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't had a chance to really look at and grok how the units framework works. I suppose it's possible that units are inferred from type and that everything gets translated into a number under the hood and plotted on the same plot, in which context I guess defining any mapping from
timedeltato that single number line is fine because these things shouldn't be plotted at the same time butmatplotlibisn't enforcing that in any way.That said, from some preliminary tests, plotting arbitrary non-datetime points on a datetime axis currently fails with a message like:
Sounds like it's a mix of the two, where you could plot non-datetime values if you got them right (because it's not enforced), but it's unlikely enough to work that there's a dedicated error message for it.
I think the right course forward for #11290 is to finish the work started in #9072 of defining all spans as
start + span, such that types with relative but no absolute semantics or meaning (likedatetime.timedeltaanddateutil.relativedelta) don't cause errors.