Reputation: 299
My code is
f = myfunc1(...); % (f=1x4 cell) % (f{i} : 1x1000000 matrix)
g = myfunc1(...); % (g=1x4 cell) % (g{i} : 1x1000000 matrix)
color = {'red', 'blue', 'green, 'black};
leg = {'~~~', '~~~', '~~~', '~~~'};
for i=1:4
figure(1);
plot(f{i}, color{i});
hold on;grid on;
figure(2);
plot(g{i}, color{i});
hold on;grid on;
end
for i=1:2
fig = figure(i);
legend(leg);
end
This gives two figures, each of whom has four lines with different colors. However, they are distinguishable in the monitor, but they are not on black distinguishable on the black-and-white printed paper. Hence, I tried to add some shapes, e.g., circle, star, dot, and etc. I want to put one type of shape on each line. (Not every point but every 100 point.)
Actually, I could do that additionally drawing shape on the result, but the legend is not changed. Is there any function to draw with a shape?
Upvotes: 1
Views: 75
Reputation: 60554
The line object created by the plot
command has a MarkerIndices
property that you can use to obtain what you want:
x = linspace(0,10,1000);
y = exp(x/10).*sin(4*x);
plot(x,y,'-*','MarkerIndices',1:10:length(y))
Example taken from the MATLAB documentation at https://www.mathworks.com/help/matlab/creating_plots/create-line-plot-with-markers.html
Note that this interacts well with legends too.
Upvotes: 1