Asymptote: Labeling
Revision as of 20:23, 28 November 2017 by Mathgeek07 (talk | contribs)
Let's say you have a point that you want to label, for example, Point A.
This is extremely simple. First, draw a dot.
dot((0,0));
Now we use the label command.
dot((0,0)); label("A",(0,0));
However, it is likely that this is not what you want your point to look like. We now fix an attribute to this label:
dot((0,0)); label("A",(0,0),S);
The location of the label could also be changed.
dot((0,0)); label("A",(0,0),N);
In fact, you can use North, West, East, South, Northwest (NW), Southeast (SE), etc etc.
Now, lets get fancy with labeling. Let's say we want to label a length. In this case, we can use :
dot((0,0)); dot((1,1)); draw((0,0)--(1,1)); label("The length is $\sqrt{2}$",(0,0)--(1,1),SE);
Notice that I labeled a line.
Even fancier:
dot((0,0)); dot((1,1)); draw((0,0)--(1,1)); label("The length is $\sqrt{2}$",(0,0)--(1,1),SE,green);