Question

I have a plot with >7 sets of data.

After the default colours are all used once (i.e. with the first 7 sets of data) I then want the marker style to change and for this to repeat every time all 7 colours have been used for each marker.

I have successfully changed the line style in this manner using:

set(0, 'DefaultAxesLinestyleOrder', '-|--|-.');

However changing this to:

set(0, 'DefaultAxesMarkerOrder', '.|+|^|s');

Returns the error:

Error using set
Invalid property found.
Object Name: axes
Property Name: 'MarkerOrder'.

I am unsure as to why substituting 'Marker' does not work. Potentially because plots by default do not have markers? Though when I try adding:

plot(nbead,x,'.')

The problem is not solved.

Does anybody know how to solve this problem?

Was it helpful?

Solution

MATLAB does not have a default marker order. Instead, you can specify the marker order within the line style specification like this:

set(0, 'DefaultAxesLinestyleOrder', '-o|--^|-.');

The cycle that MATLAB uses is locked to the color order as well, so to see other symbols you might change the color order to be shorter:

set(0,'DefaultAxesColorOrder',[1 0 0; 0 1 0]);

Then you could run the following code to show how things change:

set(0,'DefaultAxesColorOrder',[1 0 0; 0 1 0]);
set(0, 'DefaultAxesLinestyleOrder', '-o|--^|-.');

n = 15;
data = (diag(1:n) * ones(n))';

figure;
hold all
plot(data)

For the following output:

Example Image

You can refer to the Matlab axes documentation for a bit more info on axes properties.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top