hold all vs. hold on

12 次查看(过去 30 天)
mehmet
mehmet 2011-12-13
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);

回答(1 个)

Laura Proctor
Laura Proctor 2011-12-13
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 个评论
mehmet
mehmet 2011-12-13
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 2011-12-13
By the way, how do you change the font for the commands here.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Orange 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by