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
Implemented Step Signal Plot #1128
Conversation
- added function for `StepDisplay` (take-over from Scatter Plot) - added Cookbook example - all tests are passing
The step plot looks a little weird with dots drawn. I don't know if that's something that can/should be changed. Maybe just changing the demo to not draw marker points is all that should be done? |
Hi @EmanuelFeru, Good improvement, thanks for your contribution. Unfortunately, SignalXY will inherit It seems that the
It also immediately caught my eye, most likely the lack of symmetry gives such an effect. |
Yes, it's the symmetry. I was looking strange at the beginning too 😃 the dots can be hidden by making the Markersize 0. What is your opinion for the example? I can put the Markersize to 0 to have a more natural look. @StendProg, I did not fully understood. Do you mean if we do surface below for example then it still considers straight line between points? |
Exactly. The fill in the background will connect the dots and will probably be ugly. Maybe we don't need it, but most likely sooner or later this question will come up, it's up to you, I just noticed that the fill uses the old array of points in |
I see... Then it's better to have it done now. I will have a look in the next couple of days. |
I quickly checked FillBelow. Indeed it does not draw well around the steps. Still investigating how to make it plot steps. I think a change is needed on the Rectangle fill: ScottPlot/src/ScottPlot/Plottable/SignalPlotBase.cs Lines 428 to 432 in 3ead8c2
Code for the above plot: public void ExecuteRecipe(Plot plt)
{
double[] ys = DataGen.Sin(51);
int sampleRate = 1;
var sig = plt.AddSignal(ys, sampleRate);
sig.StepDisplay = true;
sig.MarkerSize = 0;
sig.FillType = FillType.FillBelow;
sig.FillColor1 = Color.Blue;
} Also I am not sure if the fill is done correctly, it behaves strange when I move and looks diagonal. I would expect to fill similar to here: |
Fixed. I will do a commit. Edit: Not sure if it is the most efficient implementation but it does the job. I think better would be to plot square rectangles using the current point (X_k, 0) and next point (X_k+1, Y_k+1). |
- Fill Above Below is consistent with `StepDisplay` - made `MarkerSize = 0` in the Cookbook for a more natural look
Hi @EmanuelFeru, thank you for this PR! Thanks @bclehmann and @StendProg for your input along the way. I'm going to refine this PR and merge it in shortly despite it not looking perfect with filled signal plots. It looks like filled signal plots have slight rendering errors already, and I'll work to investigate and hopefully fix that in a separate issue (#1163) |
Thanks @EmanuelFeru, this looks great! This feature will be in the next release 👍🚀 I'll fix the error affecting the alignment of fills shortly (#1163) |
Purpose:
Step Display is very useful to show digital signals.
New Functionality: This PR implements #1092
StepDisplay
(take-over from Scatter Plot)