Plots vectors x & y using one color for when y is greater than a given threshold value, and another color when y is less than the threshold.
You can optionally specify any standard formatting string that PLOT accepts (eg 'rx:' for a red dotted line with cross markers).
The plotting follows the standard MATLAB PLOT approach of linearly interpolating between data values. The coloring/linestyle changes at y = threshold, even on the interpolated line.
Hi Iliana, Thanks for the feedback. Unfortunately at the moment the function can't handle either of those cases. For multiple columns, you'd just have to hold on and loop over the columns. To do a vertical threshold I guess you could do it horizontally then switch all the x and y data:
>> ax = gca;
>> arrayfun(@(l) set(l,'XData',l.YData,'YData',l.XData),ax.Children)
I'll keep these ideas in mind for future improvements.
Thank you for this function! :)
Is there a way to apply it when Y has more than one vector in it? So when every line exceeds a threshold then it changes the colour?
Another question, is there a way for the threshold to apply to the index in X and not the values in Y? So the threshold would appear vertically, not horizontally?
Thank you so much!
It works well as described, but could be improved by handling multiple thresholds.