Which line is on top in a matlab graph?
Mostrar comentarios más antiguos
I am trying to make a simple plot with four sets of data, using different line properties for each data set. For some reason, Matlab seems to plot the lightest colored line on top of the darker lines, and I need to be able to see all of the darkest line, with the lighter lines in the background. Is there any way I can set which line is on top in the plot? Thanks!
Respuesta aceptada
Más respuestas (2)
Paulo Silva
el 15 de Jun. de 2011
It's the order of the plots, last thing to be added to the axes stays on top, see this example:
clf
hold on
x=0:0.1:10;
plot(x,sin(x),'linewidth',10)
plot(x,cos(x),'r','linewidth',10)
ch=get(gca,'children')
pause(2) %after two seconds the blue line goes to the top
set(gca,'children',[ch(2) ch(1)]) %reorder the children of the axes
1 comentario
Jason
el 15 de Jun. de 2011
Fangjun Jiang
el 15 de Jun. de 2011
I don't think it is the lightness or darkness of the color. It is the order of the plot that matters. Reverse the order of the following code to see the effect.
plot(2:-1:1,'g','linewidth',10);
hold
plot(1:2,'r','linewidth',10);
1 comentario
Jason
el 15 de Jun. de 2011
Categorías
Más información sobre Line Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!