Black Lives Matter. Please consider donating to Black Girls Code today.

Custom interpolation for a date plot

The interpolation options offered by on 1D signals are:

  • linear
  • spline
  • vhv
  • hvh
  • vh
  • hv

What does vhv, hvh, vh, and hv mean? Of course “linear” is the traditional “connect the dots” approach, whereas “spline” stands for “piecewise polynomial”. And also, I’d like to create my own interpolation using a non-uniform discrete Fourier transform (the bandlimited interpolation). Is there a way I can do so?

The other option would be to store the interpolated points in a list and then plot them directly without any extra interpolation, but the problem is that I have a set of points with the format {‘MM/dd/YYY’, }, and if I change the format to {‘MM/dd/YYY HH:mm:ss’, } then the nice legend that Plotly adds would be lost.

Thanks in advance for any help anyone could provide me on this.

Hi @juan.fonseca,

Welcome to Plotly forum!

The letters v, h in the names of interpolation type stand for vertical, respectively horizontal. Each one of the combinations of v and h is illustrated at the link you gave above, in the section Interpolation with Line Plots.

You can interpolate your data using your own method and finally pass the x and y lists of interpolated data to go.Scatter. To get displayed your prefered datetime format you can set xaxis_tickvals, respectively xaxis_ticktext, as it is illustrated in the answer to this forum question
i.e. no matter what kind of data you have in the go.Scatter.x, you can ensure to be displayed custom ticklabels, mapping the default tickvalues to the list xaxis_tickvals, and setting as ticklabels the strings in xaxis_ticktext.