Reputation: 161
Is there some way to plot more than 4 line styles in Matlab
(as it is stated here https://www.mathworks.com/help/matlab/creating_plots/specify-line-and-marker-appearance-in-plots.html), I mean line styles without markers?
I 've tried https://www.mathworks.com/matlabcentral/fileexchange/1892-dashline but there is some problem, it does not display line correct in the legend.
Next solution for me is gnuplot
, but I have whole calculation in Matlab
. Is there any other advice, what other to use or what to do with Matlab
to make more than 4 line styles? Will there be more line styles in next Matlab
version?
Upvotes: 0
Views: 1099
Reputation: 30046
There are only 4 line styles, and realistically that's probably a reasonable limit in terms of legibility. But there are lots of marker styles, why not make your own "lines" by plotting close together markers?
x = 1:0.01:2;
a = sin(x);
b = sin(x) - sort(rand(size(x))/4);
c = sin(x) + sort(rand(size(x))/10);
figure;
hold on
plot( x, a, 'linestyle', 'none', 'marker', 's' );
plot( x, b, 'linestyle', '-', 'marker', 'o' );
plot( x, c, 'linestyle', '-', 'marker', '*', 'linewidth', 1, 'markersize', 5);
You might need to do some interpolation to upsample your data to create the line illusion from close-together markers, interp1
is a simple way to do this.
Although I would echo Cris's comment, your plot will quickly become cluttered, consider using subplots, colours, or other devices to illustrate different series and avoid chart clutter.
Upvotes: 1