Search code examples
matlab

How to plot multiple lines with different markers


I would like to plot multiple lines with MATLAB and do it so, that markers would be different in every line. I know that with colours this would be achieved with ColorSet = hsv(12);. Is there some as simple as this method for markers?


Solution

  • Well, I am not aware of a built-in functionality of MATLAB to do so, but I do the following. I create my own cell:

    markers = {'+','o','*','.','x','s','d','^','v','>','<','p','h'}
    

    and then access it this way:

    markers{mod(i,numel(markers))+1}
    

    I also created a function, getMarker, that does that and that I added to the path of MATLAB so that I can access it in all my scripts.