I ran into an issue where fig2plotly was showing datenum values in the plot rather than the actual dates. Here is my fix.
x = datetime(2023,01,01):caldays(1):datetime(2023,02,01);
y = rand(size(x));
h = plot(x,y);
ax = gca;
plty = fig2plotly(gcf,‘offline’,true,‘open’,false);
% Code to fix dates
plty.layout.xaxis1.type = ‘date’;
plty.data{1}.x = datestr(x,‘yyyy-mm-ddTHH:MM:SSZ’);
plty.layout.xaxis1.range = datestr(ax.XLim,‘yyyy-mm-ddTHH:MM:SSZ’);
plty.layout.xaxis1.tickvals = datestr(ax.XTick,‘yyyy-mm-ddTHH:MM:SSZ’);
plty.data{1}.hovertemplate = ‘Date: %{x}
Y Data: %{y}’;
plty.PlotOptions.OpenURL = ‘true’;
plotly(plty