MATLAB Answers


How can I modify appearence of multiple plots?

Jonathan Bijman さんによって質問されました 2019 年 6 月 15 日
最新アクティビティ dpb
さんによって コメントされました 2019 年 6 月 15 日
さんの 回答が採用されました
Hi everyone
I have these commands for plotting 6 variables with its deviations standards respective.
x = linspace(0, 54, numel(T_A8_C));
X = [x;x;x;x;x;x].';
Y = [T_A8_C(:) T_C5_C(:) T_E1_C(:) T_A8_D(:) T_C5_D(:) T_E1_D(:)];
err=[T_desvA8_C(:) T_desvC5_C(:) T_desvE1_C(:) T_desvA8_D(:) T_desvC5_D(:) T_desvE1_D(:)];
title('Cell Temperature Plot')
xlabel('Time (Days)')
ylabel('Cell Temperature (°C)')
legend('A8 Clean','C5 Clean','E1 Clean','A8 Dirty','C5 Dirty','E1 Dirty');
And I want:
all variables with A8 red color, all variables with C5 blue color, all variables with E1 black color.
all variables with C with a line continuous (a little thicker than default) and all variables with D in segments (either dot-dot or dash-dot)
How can I do that with too many variables?
Thanks for your help!

  0 件のコメント

サインイン to comment.

1 件の回答

回答者: dpb
2019 年 6 月 15 日

Save the errorbar object returned handles and set properties as desired.

  4 件のコメント

2019 年 6 月 15 日
hEB=errorbar(X,Y,err); % save returned errorbar object handles
hEB(1).Color=... % set given line color
Since the dot notation is only able to address a single handle at a time, if you were to define arrays of properties like colors by line for each grouping, then you can cut down the actual amount of code significantly by using the set command to set the entire array of handles at one time by passing a cell array of the proper size. There are examples of such use in the documentation for set. This would draw all the lines as default and then set the proroperties afterwards. If you cared about the appearance in the intermediate stages all that much, you could add each individually with hold on and set each line style when plotted. The first is more efficient...
Jonathan Bijman 2019 年 6 月 15 日
Thanks a lot @dpb, it really helps! =)
2019 年 6 月 15 日
Glad to pays to read and search the documentation for "how to" topics...

サインイン to comment.

Translated by