Only show parts of a line with a certain value?
8 views (last 30 days)
Show older comments
I have a line at the top of my graph that is intended to deliniate when in time there are significant values in the main effect, however where the line dips up (to non-significant values) the curve of the line is visible and it looks like the significance line is longer than it is intended (see image). Making the line invisible and only using markers also does not work as the markers overlap with these non-significant values at the size I need to see the line(see attached image).
TLDR: I would like to know if there is a code to plot the only parts of a line that have values on the y axis that meet a certain theashold. I do not want any other values to be shown other than the ones that are at 200 in this case and none above that so i dont see this little orage flap at the top.
Thanks in advance!

3 Comments
dpb
on 22 Sep 2022
No, not really...seems extremely convoluted way to go about doing anything -- don't see the purpose from just the code and the actual expected result isn't explained clearly, sorry...
Why do you need to retrive the data of "... the line that was just created" by extracting it from a line handle that had to go handle-diving for when if the line was "just created", the x,y data have had to already be available in the variables used in the plot command itself? Why not just use them?
And this thing about burying some magic constant inside the code for the "significance" line is just trouble from the git-go to write code in that manner -- surely there's some reason for choosing whatever number it is that can be written as code logic rather than editing executable code every time...
But, then, all that aside, it's not at all clear what the problem is we're trying to solve -- your original question talked about not displaying points with a given magnitude -- that's what the code provided above would do -- but you're intentionally drawing this line above...so what is/isn't supposed to be shown?
Post a runnable MWE (minimum working example) with a small sample size of data and then explain precisely what it is that is not as desired on the resulting image. We just don't have anything to work with here...
Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!