Group Abstract Group Abstract

Message Boards Message Boards

0
|
37 Views
|
1 Reply
|
1 Total Like
View groups...
Share
Share this post:

Recommended way of adding Text to Graphics & Arrow function

Posted 1 day ago

Hi; Please see attached notebook. Is there a better way to add text to Primitives such as Arrows in Graphics functions? I tried using the function PlotLegends which did not work ether. The following code does not generate the Blue Arrow Text - Just an error message. What is the recommended way of adding text to the Arrow Function?

Thanks,
Mitch Sandlin

In[93]:= Graphics[
 {Red, Arrow[{{0, 0}, 1.1*{1, 1}}], 
  Text[Style["My Red Label", Bold, 14], {1.1, 1.1}],
  Blue, Arrow[{{0, 0}, .7*{5, 1}}]}, 
 Text[Style["My Blue Label", Bold, 14], {3.1, 3.1}],
 Axes -> True, AxesLabel -> {"Foxes", "Rabbits"}, 
 LabelStyle -> {GrayLevel[0], Bold}]
Attachments:
POSTED BY: Mitchell Sandlin

The error was because the curly braces did not include the second Text:

Graphics[{Red, Arrow[{{0, 0}, 1.1*{1, 1}}], 
  Text[Style["My Red Label", Bold, 14], {1.1, 1.1}, {0, -1}], Blue, 
  Arrow[{{0, 0}, .7*{5, 1}}], 
  Text[Style["My Blue Label", Bold, 14], .7*{5, 1}, {1, -1}]}, 
 Axes -> True, AxesLabel -> {"Foxes", "Rabbits"}, 
 LabelStyle -> {GrayLevel[0], Bold}]

I have added offsets to the texts.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard