Can I have same plot colors between 2 different figures?
Mostrar comentarios más antiguos
Hi,
I have 2 Figures. Each has a Axes area with 4 plots each.
When I do 'hold all' - Matlab assign colors to the plots automatically.
I want to have the two figures plot colors the same meaning - Line#1 in Axis#1 will have the same color as Line#1 in Axes#2....
Is it possible to do so without setting manually the colors to each line?
Is there a 'hold' sequence where this might work?
Respuestas (1)
Azzi Abdelmalek
el 4 de Mzo. de 2013
Example
t=0:0.1:10
y11=cos(t)
y12=2*cos(t)
h1(1)=plot(t,y11)
hold on
h1(2)=plot(t,y12)
set(h1(1),'color','red')
set(h1(2),'color','green')
figure
y21=sin(t)
y22=2*sin(t)
h2(1)=plot(t,y21)
hold on
h2(2)=plot(t,y22)
set(h2(1),'color','red')
set(h2(2),'color','green')
6 comentarios
Nimrodb
el 4 de Mzo. de 2013
Azzi Abdelmalek
el 4 de Mzo. de 2013
Can you post how did you get those four plots?
Azzi Abdelmalek
el 4 de Mzo. de 2013
You can also do:
set(h1,{'color'},{'red';'green'})
I don't know why you call this manually?
Nimrodb
el 5 de Mzo. de 2013
Azzi Abdelmalek
el 5 de Mzo. de 2013
Editada: Azzi Abdelmalek
el 5 de Mzo. de 2013
Then What is the problem? Just use hold all, with the order of plotting you want. The colors are givens in the order
Categorías
Más información sobre Graphics Object Properties 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!