File Exchange

image thumbnail

Add plot markers to an existing plot

version 1.2 (1.94 KB) by

Add a specified number of markers to a plot

3 Downloads

Updated

View License

Add a specified number of markers to a plot instead of a marker at each datapoint which is the default in Matlab

Comments and Ratings (5)

Karl

Karl (view profile)

I like this function but when I set(gca,'Xlim',[startnum endnum]) the plot extend outside of the box.

E.

E. (view profile)

Yep, with some additional changes (such as Carl Fischer suggested) this is very useful code!

Carl Fischer

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.

Carl Fischer

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 :-)

Carl Fischer

Useful but it seems you need to increase the number of markers by 2 to obtain the correct number.

Updates

1.2

- Output handle now retains the linestyle from the input handle - useful for the legends
- The markers are spaced randomly so that they don't obscure eachother.
- Markers are added to the correct subplot

1.1

Number of makers is now optional with 5 markers being default.
The output handle is now also optional.

MATLAB Release
MATLAB 7.5 (R2007b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video