Remove "data1" & "data2" recession plot legend
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Gus Abraham
el 25 de Ag. de 2021
Comentada: Niko
el 31 de Mayo de 2023
I'm plotting a return series with a recession plot as an overlay. The issue is that the recession "bars" shows up as data1 and data2 in the legend.
How do I remove "data1" & "data2" from the legend?
clear
clc
v = datevec({'31-Jan-2000','31-May-2021'});
date = datenum(cumsum([v(1,1:3);ones(diff(v(:,1:3))*[12 1 0 ]',1)*[0 1 0 ]]));
x=randn(257,1);
figure;
plot(date,x);
datetick('x','yyyy');
legend('x');
recessionplot;
0 comentarios
Respuesta aceptada
the cyclist
el 25 de Ag. de 2021
The simplest is probably to just wait until all the plots are created before adding the legend.
v = datevec({'31-Jan-2000','31-May-2021'});
date = datenum(cumsum([v(1,1:3);ones(diff(v(:,1:3))*[12 1 0 ]',1)*[0 1 0 ]]));
x=randn(257,1);
figure;
plot(date,x);
datetick('x','yyyy');
recessionplot;
legend('x')
1 comentario
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Preprocessing en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!