Azzera filtri
Azzera filtri

Shading an area across zero

1 visualizzazione (ultimi 30 giorni)
Will
Will il 16 Ott 2012
Risposto: Meg Wang il 8 Lug 2021
I have a plot of zscores and would like to highlight a particular area of the graph. This is the relevant code i'm using:
xmin = plot_time-time_period; xmax = plot_time; %called from a matrix
x = [xmin xmax];
yLimits = get(gca,'YLim');
h1 = area(x,[yLimits(1) yLimits(1)]);
h2 = area(x,[yLimits(2) yLimits(2)]);
set(h1,'Facecolor','k')
set(h2,'Facecolor','k')
alpha(0.15)
Which produces this:
I would like to remove the line across zero, but the following code just creates nonsense:
h1 = area(x,[yLimits(1) yLimits(2)]);
Any ideas? Thanks.

Risposte (2)

Doug Hull
Doug Hull il 16 Ott 2012
I think you are looking for this:

Meg Wang
Meg Wang il 8 Lug 2021
set(h1, 'ShowBaseLine', 'off')

Categorie

Scopri di più su Discrete Data Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by