How to change the standard of coloring figures

19 vues (au cours des 30 derniers jours)
Tim Sønderby
Tim Sønderby le 3 Nov 2011
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,

Réponses (3)

Jan
Jan le 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 commentaire
Patrick Kalita
Patrick Kalita le 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).

Connectez-vous pour commenter.


Fangjun Jiang
Fangjun Jiang le 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;

Tim Sønderby
Tim Sønderby le 3 Nov 2011
But this only help half the problem as I still have to manually change all the line styles otherwise I cannot distinguish them from each other.

Catégories

En savoir plus sur Graphics Object Identification dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by