|
|
| File Information |
| Description |
The annotation function, which allows you to programmatically add a wide range of annotations to your figure, requires coordinates to be specified in normalized figure units. I have found that I almost always want to specify my annotations in data space (i.e., based on the values of data displayed in an axes).
This utility function converts coordinates in data space into normalized figure coordinates, for input to annotation. Some annotations require you to specify (x,y) pairs, while others require a 4 element position vector. This function supports both syntaxes.
Here's a simple example:
% Create some data
t = 0:.1:4*pi;
s = sin(t);
% Add an annotation requiring (x,y) coordinate vectors
plot(t,s);ylim([-1.2 1.2])
xa = [1.6 2]*pi; % X-Coordinates in data space
ya = [0 0]; % Y-Coordinates in data space
[xaf,yaf] = ds2nfu(xa,ya); % Convert to normalized figure units
annotation('arrow',xaf,yaf) % Add annotation
Note: I believe annotation was introduced in MATLAB 7. |
| Acknowledgements |
This submission has inspired the following:
axescoord2figurecoord
|
| MATLAB release |
MATLAB 7.2 (R2006a)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Comments and Ratings (12) |
| 05 Oct 2006 |
kerr hatrick.
|
|
|
| 12 Oct 2006 |
Axiom .
|
|
|
| 06 Dec 2006 |
Vivek Goyal
|
|
|
| 06 Dec 2006 |
Lucian P
|
|
|
| 08 Dec 2006 |
Scott Hirsch
|
|
|
| 10 Jan 2007 |
BenoƮt Valley
|
|
|
| 25 Apr 2007 |
Tim Mullen
|
|
|
| 19 Feb 2008 |
Scott McClure
|
|
|
| 17 Mar 2008 |
Till Junge
|
|
|
| 24 Sep 2008 |
Matt Brunner
|
|
|
| 20 Mar 2009 |
Yan Luo
|
|
|
| 27 May 2009 |
Maxie
|
|
|
|
MATLAB Central Terms of Use
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central.
Read the complete Terms prior to use.
Contact us at files@mathworks.com