hold all vs. hold on

14 views (last 30 days)
mehmet
mehmet on 13 Dec 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);

Answers (1)

Laura Proctor
Laura Proctor on 13 Dec 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 Comments
mehmet
mehmet on 13 Dec 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 on 13 Dec 2011
By the way, how do you change the font for the commands here.

Sign in to comment.

Categories

Find more on Colormaps in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!