Filter löschen
Filter löschen

Coloring the background of a plot

2 Ansichten (letzte 30 Tage)
Richard Miller
Richard Miller am 17 Jul. 2021
Beantwortet: Walter Roberson am 17 Jul. 2021
I plotted a data set and a phase in a stacked plot with tick marks every 50 units on the x-axis and a grid line at every tick mark. The plot has a lot of features that I need to compare between the top and bottom graphs but I am having a hard time seeing things and I was wondering if there was a way to alternate between gray and white backgrounds for the plot that is between 0 and 50 it would be white, then 50 to 100 would be gray, then 100 to 150 white and so on.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 17 Jul. 2021
You can use fill(). If you do that first before you plot, the fill will be "below" the lines (but see also the SortOrder property described in http://blogs.mathworks.com )
However, this approach might not work as smoothly as you like if you need to be able zoom or pan to outside the original area and you want the background to continue to be colored for the newly exposed area.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by