-
-
Notifications
You must be signed in to change notification settings - Fork 403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Datetime64 fixes #816
Datetime64 fixes #816
Conversation
@@ -61,6 +63,14 @@ def get_data(self, element, ranges, style): | |||
ys = element.dimension_values(1) | |||
return (xs, ys), style, {} | |||
|
|||
def init_artists(self, ax, plot_args, plot_kwargs): | |||
xs, ys = plot_args | |||
if xs.dtype.kind == 'M': |
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.
Might be worth adding a comment mentioning what the 'M' code means. I assume it is the numpy datetime64 type?
Looks good. Ready to merge? |
Think there might be a few more places where datetime64 support can be improved. Will investigate a bit more. |
I've now overhauled the PR again. The main changes here are that you can now register datetime formatters for datetime64 and datetime types, which means you can now do this: %%opts Curve [xrotation=15 xticks=5]
import numpy as np
from datetime import date
import pandas as pd
start = date(2012, 1, 15)
end = date(2012, 1, 30)
hv.Dimension.type_formatters[np.datetime64] = '%m/%d'
hv.Curve((pd.date_range(start, end, freq='D'), np.random.rand(16))) Additionally I fixed various bugs in xarray date range handling and made formatting of grid tick labels consistent with everything else. Ready to merge now, but there's a definite possibility tests will break due to Grid tick formatting changes. |
Ready to review, updated test data will pass shortly. |
@@ -262,9 +262,6 @@ class GridPlot(CompositePlot): | |||
show_legend = param.Boolean(default=False, doc=""" | |||
Legends add to much clutter in a grid and are disabled by default.""") | |||
|
|||
tick_format = param.String(default="%.2f", doc=""" |
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.
So this parameter is now deprecated?
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.
Hmm, yes, we have a system for tick formatting using Dimension.value_format
and Dimension.type_formatters
, so this is redundant. You think we need to go through a deprecation cycle for this?
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.
It will at least need to be mentioned in the CHANGELOG. Other than that I think it is fine.
Looks good. I've made two comments and once you have addressed those, I am happy to merge. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Matplotlib does not currently support plotting numpy datetime64 types directly. This PR adds a compatibility layer ensuring these types are converted appropriately for plotting in matplotlib.