How to change plot background color for some datapoints?

19 次查看(过去 30 天)
I would like to produce a plot as shown below. The feature I am looking are the different background colors for some of the datapoints. How can I do this?
Thank you!

采纳的回答

Walter Roberson
Walter Roberson 2016-4-4
You can use rectangular regions with fill(), or you can use rectangle() with a FaceColor . Either way, you can draw those background areas first, or if you draw them after the plot be sure to uistack() them to the beneath the plot lines.
  5 个评论
Claire Andreasen
Claire Andreasen 2020-8-17
if you're using a grid, how would you make the grid appear overtop the rectangle?
Walter Roberson
Walter Roberson 2020-8-17
Grids are considered part of an axes. You can have axes appear on top by setting the axes Layer property to 'top' instead of the default 'bottom'

请先登录,再进行评论。

更多回答(1 个)

Muhammad Usman Saleem

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by