I am plotting some data in a C#/WinForms app using ScottPlot. I need to switch between a heatmap view and time series view, which I select using radio buttons. If I plot the time series view first, the axes are scaled correctly and I can see all of the data. But if I plot the heatmap first and then switch to the time series, the plot is zoomed in to show only about 30 out of 3000 points. (The heatmap always displays correctly.) I've tried using both AxisAuto() and SetAxisLimits() to reset the axes, but it doesn't seem to have any affect.
private void PlotHeatMap()
{
plt.Clear();
var hm = plt.AddHeatmap(kWArray, ScottPlot.Drawing.Colormap.Turbo);
hm.FlipVertically = true; // So that midnight is at the bottom.
var cb = plt.AddColorbar(hm);
//plt.Margins(0, 0);
formsPlot1.Refresh();
}
private void PlotTimeSeries()
{
plt.Clear();
plt.AddSignal(kWVector);
plt.AxisAuto();
//plt.SetAxisLimits(0, 3000, 0, 8);
formsPlot1.Refresh();
}
Any idea what I'm doing wrong?
With some help from the developer, I was able to get this working. The problem is that the timeseries was using a date axis, whereas the heatmap uses a numerical axis. So, when plotting the timeseries, you need to add the following line of code:
timeFFTPlot.XAxis.DateTimeFormat(true);
And when plotting the heatmap, you use this:
timeFFTPlot.XAxis.DateTimeFormat(false);