View License

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

» Watch video

Highlights from
Add plot markers to an existing plot

4.0 | 3 ratings Rate this file 11 Downloads (last 30 days) File Size: 1.94 KB File ID: #23279 Version: 1.2
image thumbnail

Add plot markers to an existing plot


Matthijs (view profile)


13 Mar 2009 (Updated )

Add a specified number of markers to a plot

| Watch this File

File Information

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

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
12 Jan 2012 Karl

Karl (view profile)

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

28 Mar 2011 E.

E. (view profile)

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

12 Oct 2010 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.

Comment only
13 Oct 2009 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 :-)

01 Apr 2009 Carl Fischer

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

Comment only
20 Mar 2009 1.1

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

11 Aug 2009 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

Contact us