Conditionally colored line plot

Plots (2D line) graph split into two colors above and below a given threshold value

您现在正在关注此提交

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 (2026). Conditionally colored line plot (https://ww2.mathworks.cn/matlabcentral/fileexchange/30423-conditionally-colored-line-plot), MATLAB Central File Exchange. 检索时间: .

类别

Help CenterMATLAB Answers 中查找有关 Line Plots 的更多信息

一般信息

MATLAB 版本兼容性

  • 兼容任何版本

平台兼容性

  • Windows
  • macOS
  • Linux
版本 已发布 发行说明 Action
1.1

Made a quick hack to the input-parsing utility to deal with the change in precedence rules. It should now work in 19b and in previous versions. Hasn't been really thoroughly tested, though, so please report any problems.

1.0.0.1

Updated license

1.0.0.0