How to plot multiple lines with different markers

后端 未结 6 1681
感情败类
感情败类 2021-02-03 12:27

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

6条回答
  •  情深已故
    2021-02-03 13:11

    I am using a simple procedure to randomly create new styles for plots. Though it is not really an iteration but someone may find it useful:

    function [styleString] = GetRandomLineStyleForPlot()
    % This function creates the random style for your plot
    % Colors iterate over all colors except for white one
      markers = {'+','o','*','.','x','s','d','^','v','>','<','p','h'};
      lineStyles = {'-', '--', ':', '-.'};
      colors = {'y', 'm', 'c', 'r', 'g', 'b', 'k'};
      styleString = strcat(markers(randi(length(markers), 1) ), ...
                    lineStyles(randi(length(lineStyles), 1) ), ...
                    colors(randi(length(colors), 1) ) );
    
    end
    

提交回复
热议问题