Add a specified number of markers to a plot instead of a marker at each datapoint which is the default in Matlab
I like this function but when I set(gca,'Xlim',[startnum endnum]) the plot extend outside of the box.
Yep, with some additional changes (such as Carl Fischer suggested) this is very useful code!
I'm surprised this hasn't got more good ratings and comments.
May I suggest you also copy the LineWidth and MarkerSize properties from the original plot to the markers. Currently you only copy the LineStyle and Color. Even if there are no markers in the original plot the MarkerSize property can still be set.
Thanks for the update. A couple of minor issues. The function won't cope with more than 13 plots, and also fails if called with N=1. There's not much you can do about this but a clear error message for these cases would be an improvement and would have saved me about 10 seconds :-)
Useful but it seems you need to increase the number of markers by 2 to obtain the correct number.
- Output handle now retains the linestyle from the input handle - useful for the legends
Number of makers is now optional with 5 markers being default.
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.