How can I add color to predefined?
古いコメントを表示
Hi,
The plot function have a set of 7 colors that are predefined and can be added as
plot(any_x,any_y,'r');
There are seven colors, where 5 of them are suitable for plotting (white and yellow is hard to see). I like to work with different colors, because this makes it much easier to distiguish differences in plots and to keep an eye of which plot is which.
However, the problem is that sometimes I need more colors than 5. I know that it is possible to use subplots, linestyle, ... to improve this, lets say that you want to plot I different quantity as
plot(any_x,any_y,'r.');
for different data in separate plots and want to be able to enlarge the plot if necessary (which is impossible with subplot). You may also want to plot 10 polygons in the same plot and then is may be annoying to have to make a double loop and so to change linestyle.
The above is a motivation to where it may be necessary to have more colors and since the keyword is simplicity here. The simplest solution is then clearly,
colorloop = 'bgrkm';
for datai = 1:min(size(datax))
plot(datax(datai,:),data(datay,:),color,colorloop(mod(datai-1,5)+1)),'linestyle','.');
end
or similar. This is why I wonder, are there ways to add a color to the predefined, that would simplify everything a lot.
採用された回答
その他の回答 (1 件)
nl2605
2014 年 3 月 13 日
0 投票
Probably this might help you. It helped me.
3 件のコメント
John D'Errico
2014 年 3 月 13 日
Note to others: I did check this video, it is indeed about MATLAB.
For nl2605, you might add more descriptive information to your answer to convince those who might look at your answer and be unsure if you are posting a spam answer. I would suggest briefly explaining what the video teaches.
nl2605
2014 年 3 月 13 日
Got it. Will be careful next time.
Patrik Ek
2014 年 3 月 13 日
カテゴリ
ヘルプ センター および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!