New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AxisAuto() should ignore invisible plots #623
Comments
Hi @kutukvpavel, I'm happy to hear you are enjoying this library! You're right that However, you can achieve this right away by implementing your own automatic axis function. Here's a console application which demonstrates how to do this. I hope you find it useful! var plt = new ScottPlot.Plot();
// make a small plot
var small = plt.PlotScatter(new double[] { 1, 2, 3 }, new double[] { 1, 2, 3 });
// make a large invisible plot
var big = plt.PlotScatter(new double[] { 10, 20, 30 }, new double[] { 10, 20, 30 });
big.visible = false;
// set axis limits traditionally (fits invisible plots)
plt.AxisAuto();
// determine axis limits of all visible plots
var visiblePlottables = plt.GetPlottables().Where(x => x.visible);
var limits = visiblePlottables.First().GetLimits();
foreach (var plottable in visiblePlottables)
limits.ExpandXY(small.GetLimits());
// set axis limits based on visible plot limits and zoom out a bit
plt.Axis(limits.x1, limits.x2, limits.y1, limits.y2);
plt.AxisZoom(.9, .9);
plt.SaveFig("test.png"); |
To keep things consistent I didn't change the behavior in ScottPlot 4.0 but I did do this for 4.1 (not yet released). The code example above should fully achieve what you're trying to do in the mean time though! 👍 Thanks again for the tip |
Hi!
First of all, great library, exactly what I was looking for to plot my real-time data! I'm using the latest release version.
I have several scatter plots in one WPF control and I'm able to control their visibility (I've linked Plot.visible fields to some checkboxes). However, I noticed that plot visibility doesn't affect AxisAuto() result. Is it possible to exclude hidden plots from computation of the limits?
The text was updated successfully, but these errors were encountered: