How to change the standard of coloring figures
19 次查看(过去 30 天)
显示 更早的评论
I would like to have matlab giving my plots in b balck and white and using different styles of dotted and dashed lines instead on the standard way of differing plots with color.
This would make it much easier when you export the figure for an article.
guess there must be a way to set this up in MATLAB.
thanks,
0 个评论
回答(3 个)
Jan
2011-11-3
figure('DefaultAxesColorOrder', [0 0 0; 0.4, 0.4, 0.4; 0.7, 0.7, 0.7], ...
'DefaultAxesLineStyleOrder', '-|:|.-');
plot(bsxfun(@plus, rand(100, 16), 1:16)); % Test data
I've omitted the '--' style, because it looks confusing sometimes.
You can set the color style as default for all new figures also:
set(0, 'DefaultAxesColorOrder', ...)
To reset it after creating the black and white diagrams:
set(0, 'DefaultAxesColorOrder', 'factory')
I prefer markers in BW diagrams with more than 4 different lines. For a line with 100 points it looks ugly when 100 markers appear. Therefore I've written a LineWithMarkers function, which adds only 10 markers per line. In addition The X-locations of the markers are shifted horizontally to reduce the overlap between the markers.
1 个评论
Patrick Kalita
2011-11-3
And if you want these defaults to apply for all figures in every MATLAB session, you can add the set(0, 'Default.. calls to a startup.m file (http://www.mathworks.com/help/techdoc/ref/startup.html).
Fangjun Jiang
2011-11-3
Function plot() allows you to specify the line color, marker and line style. You'll just need to specify the color as black ('k') all the time. To set the background color as white, use set().
f=figure(1);
set(f,'color',[1 1 1]);
plot(magic(10),'k');
grid on;
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Identification 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!