This is an interactive data label. Just click on a point on a plot to see it's value. Drag the point around to see how the value changes. Click at another location to add a new label.
I build this back in the day before MATLAB had data tips. I'd recommend starting with them first before seeing if you like this one better (click on the button just to the right of rotate on the figure toolbar).
Ella - Just update this line of code (line 89):
th = text(xv,yv,[' (' num2str(xv) ',' num2str(yv) ')']);
This is the command that generates the text that is displayed. If you wanted to just show a raw x value, for instance, you could change it to:
th = text(xv,yv,num2str(xv));
Hello, How can I do to display only the x label
it'll be really great if this function can be put in plot toolbar alongside data cursor.
The benefit of this function is that you can get row index of your data and timestamp if you like which really helps in data analysis.
Great file. I made a simple modification to output indices rather than coordinates. T This way I can identify the interesting points on a scatter plot and investigate them.
For time series data you can get the 'x coordinate' as a date string by changing line 89 to ...
th = text(xv,yv,[' (' datestr(xv) ',' num2str(yv) ')']);
When you click on a feature it will tell you when it happened as a date and time rather than a cryptic matlab date number. One area where Excel seems to be better than Matlab (until now!).
I have a curve in 2d. Every point of this curve is correspond to another rows of a (n,3) matrix.
Is it possible with "datalabel" or do you know any other hint?
Very useful, thanks a lot
Thank you so much. This is perfect.
Thanks dude. This is exactly what I was looking for. Excellent
Its Great... Thanks :-]
Great Great Job.
More, Is possible to have a transparent.
Cool and easy to upgrade!
If you wish to get optional label backgrounds, text size, text color&style or even optional label position simply change input, store additional fields with "setappdata" and get them further with "getappdata".
It is also not difficult to modify code to get labels in between of XY line data points:).
Cool...just what we wanted!
Simply superb! great work.
You are an excellent guy!!
This added feature is great! I've always wanted to be able to this to my plots.
Cleaned up title
Made available as an easy-to-install Toolbox file.
Removed mistaken attribution
Bug fix: Now works on horizontal lines. Thanks to Robert Young for catching this and fixing the code!
Add telemetry keyword.
The text labels can now be moved relative to the data markers. This makes it easier to read labels that might have been obscured by other data.
Through discussions with our developers, I realized that this file has the same name as a file that will be included in R13 (the capabilities are different). Would it be possible to change the name to datalabel?