-
Notifications
You must be signed in to change notification settings - Fork 38
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 slider text support #21
Conversation
cfc6fa3
to
725a876
Compare
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'm not sure how I feel about special casing this, but if I user specifies a value for valfmt
, then it should not be overridden.
In xarray I made a special case which uses I think the ideal general solution to this would mean the positioning of the play/pause button needs to be intelligent: it needs to take the length of the text string into account. |
It might be a good idea to move the default play/pause button location or make the automatic placement more intelligent, but I think that is beyond the scope of this PR. |
Is import numpy as np
import animatplot as amp
import matplotlib.pyplot as plt
bimonthly_days = np.arange(0, 60)
base_date = np.datetime64('2017-01-01')
dates = base_date + bimonthly_days
t = np.linspace(0, 3, len(dates))
x = np.arange(0, 10, .2)
X, T = np.meshgrid(x, t)
Y = np.sin(X+T)
block = amp.blocks.Line(X, Y)
timeline = amp.Timeline(dates)
anim = amp.Animation([block], timeline)
anim.timeline_slider(valfmt='%s')
plt.show() Obviously, the play/pause button overlapping is still an issue. |
725a876
to
f38d9d0
Compare
f38d9d0
to
9d3ee51
Compare
Made the changes. I'm not sure how to test it though. |
Closes #20
This makes it marginally better:
What do I need to do to make this much, much better ;)