MATLAB: Allocating marker in for loop plotting I tried to allocate a marker to each plot in for loop but I could'nt. would you please help me with that? I was able to give each plot a disired color but for marker the error shows up. Many thanks Best Answer Try this:markerShapes = {'.', 's', 'd', '^'}; % However many you needfor k = 1 : numPlots % numPlots must be less than the number of marker shapes. thisColor = rand(3, 1); % Random color or whatever... plot(x, y, markerShapes{k}, 'Color', thisColor); hold on;end Related SolutionsMATLAB: How can a draw a line between two points Assuming that x, average, and average_2 are all row vectorsaxes;hold on;plot(x, average,'o', 'MarkerEdgeColor', 'b', 'MarkerFaceColor', 'b'); % Blue pointsplot(x, average_2,'o', 'MarkerEdgeColor', 'r', 'MarkerFaceColor', 'r'); % Red pointsplot([x;x], [average; average_2], '-k');If the data are column vectors you'll have to transpose the arrays. MATLAB: How to change the line color in a graph using plot Two examples: plot(x, y, 'r') %named color, red plot(x, y, 'Color', [0.37 0.88 .06]) %unnamed color given by relative intensities Related QuestionSaving full screen multiple figuresHow to give the lines color based on the distanseDoes anybody know how to plot this figureWant to create colors depending on the number of columns i got in the XLenend keep only text
Best Answer