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.
引用格式
Matt Tearle (2025). Conditionally colored line plot (https://www.mathworks.com/matlabcentral/fileexchange/30423-conditionally-colored-line-plot), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
创建方式
R2010b
兼容任何版本
平台兼容性
Windows macOS Linux类别
- MATLAB > Graphics > 2-D and 3-D Plots > Line Plots >
在 Help Center 和 MATLAB Answers 中查找有关 Line Plots 的更多信息
标签
致谢
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!