How to change the standard of coloring figures
18 views (last 30 days)
Show older comments
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 Comments
Answers (3)
Jan
on 3 Nov 2011
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 Comment
Patrick Kalita
on 3 Nov 2011
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
on 3 Nov 2011
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 Comments
See Also
Categories
Find more on Graphics Object Identification 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!