datetime64 slider text support - #21
Conversation
cfc6fa3 to
725a876
Compare
t-makaro
left a comment
There was a problem hiding this comment.
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 ;)