hold all vs. hold on

15 vues (au cours des 30 derniers jours)
mehmet
mehmet le 13 Déc 2011
If I use hold all when I have multiple plot functions, the colormap looks smooth and easy on eye. However, if I use hold on and specify the line colors for each plot function (i.e. '-b', '-g' etc.), the colors look too bright and harsh on eye.
I think hold all uses a different colormap but I haven't been able to incorporate this coloring to individual color setting as mentioned above.
How can I change the colormap when I choose to define the line color for each plot as in the example below? Thanks.
plot(x1,y1, '-sg', 'LineWidth', 2); plot(x2,y2, '-sb', 'LineWidth', 2); plot(x3,y3, '-sr', 'LineWidth', 2);

Réponses (1)

Laura Proctor
Laura Proctor le 13 Déc 2011
You can find the colors used for hold all by issuing the command
get(gca,'ColorOrder')
which returns:
0 0 1.0000
0 0.5000 0
1.0000 0 0
0 0.7500 0.7500
0.7500 0 0.7500
0.7500 0.7500 0
0.2500 0.2500 0.2500
They may be different than the colors used by the alphabetic code.
The green is different. To use the green from hold all:
plot(1:10,'Color',[0 0.5 0])
  2 commentaires
mehmet
mehmet le 13 Déc 2011
That command returns the exact same matrix for both figures (hold all and hold on).
0 0 1.0000
0 0.5000 0
1.0000 0 0
0 0.7500 0.7500
0.7500 0 0.7500
0.7500 0.7500 0
0.2500 0.2500 0.2500
mehmet
mehmet le 13 Déc 2011
By the way, how do you change the font for the commands here.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Orange dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by