I would like to visualize 1024 values in a stem plot with a logarithmic y-scale. With a linear scale it works fine, but with a logarithmic scale the graph looks wierd. Is there a bug in my code or in oxyplot?
My stem plot looks like this: reversed stem plot
This is my source code:
var plotModel = new PlotModel { Title = "Stem Plot" };
plotModel.Axes.Clear();
if (yScalingType==(int)YScalingType.log)
{
LogarithmicAxis axisY = new LogarithmicAxis
{
Position = AxisPosition.Left,
MajorStep = 20,
UseSuperExponentialFormat = false,
Base = 10
};
axisY.AbsoluteMaximum = 1000;
axisY.AbsoluteMinimum = 0;
plotModel.Axes.Add(axisY);
}
var series = new StemSeries();
plotModel.Series.Add(series);
for (int i = 0; i < 1024; i++)
series.Points.Add(new DataPoint(i, 100.0));
There is an open issue regarding this on the github page of OxyPlot. As suggested by a user (see here), a temporary fix could be to set the Base
value of your series to 1 (var series = new StemSeries { Base = 1d };
)... the graph is then displayed properly!