Feb-05-2021, 02:31 AM
I have a matplotlib scatter plot with dates on the x axis, that updates with a slider, very similar to the example linked here. Per this example, I had been using
As I understand it, the purpose of using
np.vstack()
, but with my dates converted into floats. That worked fine.xx = np.vstack((df['date'], df['cups'])) scat.set_offsets(xx.T)However, I am now passing datetime objects to the scatter plot, so that my x axis shows dates instead of floats, and this seems to break
np.vstack()
, since it requires the numpy array to have mixed datatypes.As I understand it, the purpose of using
vstack
is to get the data in the right shape for set_offsets
. Since the end-goal is to call set_offsets with the right kind of structure, the solution need not use vstack
. However, I'm just not sure how to get the structure that set_offsets
requires without using vstack
.