Very nice function. A suggestion to improve your function is to scale the colorbar xticks based on the reference value rather than 0:1. It would eliminate the need for the user to do the multiplication.
Here is the snippet of code I use to do such a task:
set(cb, 'xticklabel', get(cb, 'xtick') * refval);
cb is a handle to the colorbar or in your case can be turned on if the option colormap is defined in line 331.
01 Jul 2014
Automatically label points in your plot given x and y values and a string of labels.
Author: Adam Danz
Very useful. Thanks.
Have a problem using with subplot. Even with the use of the extra option its placement of labels is crazy.
Was using it with a (4,2,s) subplot of bar graphs to plot frequencies and label with probabilities.
Any help to fix the issue would be nice
If you are just looking for the standard Euclidean distance you can leave off the dfcn argument and it will be used by default.
Otherwise it expects a function handle. The 'ordinary' distance function is passed as:
dfcn = @(p,q) sqrt(sum( (p-q).^2 ));
But any function will work that operates on points p and q that respects their dimensionality. A Chebyshev-like measure could be used, for example:
dcheb = @(p,q) max(abs(p-q))
Zach and Lingi; I would like to compare two drifter tracks (lat, long pairs). I tried using 'distance' from the Mapping Toolbox, but this dosn't work. Can you provide an example of dfcn function that does work? Thanks,