Message Boards Message Boards

0
|
25031 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Adding an Arrow and Text to a Plot

Posted 11 years ago
Hello, 

So I want to make an arrow in Epilog point at the numerical value 35.000 on the x-axis, and I also want to include text at the arrow to Illustrate what is happening at 35.000. 

Here is how my code looks like:
 Subscript[y, f][x_] := x/70000
 
 Subscript[y, b][x_] := x/50000
 
 Plot[{Subscript[y, f][x], Subscript[y, b][x]}, {x, 0, 70000},
 
  PlotStyle -> {Red, Blue}, AxesLabel -> {"x(km)", "\!\(\*
 
 StyleBox[SubscriptBox[\"y\", \"f\"],\nFontColor->RGBColor[1, 0, \

0]]\),\!\(\*

StyleBox[SubscriptBox[\"y\", \"b\"],\nFontColor->RGBColor[0, 0, \

1]]\)"}, Epilog -> {Arrow[{35000,

     0.5}]}], Text["Hjulskifte", [{35.000 , 0.5}]]
Also I seem to have a problem with subscript when posting Mathematica code. Any way to disable it?

Problem: I don't get any arrow neither any text. 
POSTED BY: Jakob A
2 Replies
Posted 9 years ago

Hi Please check this:

    Plot[3 Sin[x], {x,-6,6},Epilog->{{Arrow[{{5,1.8}, {3,1}}], Text["E=5",{5, 2}],
       Arrow[{{5, 1.8},{2, 1}}],Text["E=5", {4, 2}]},Text["E=4", {-3, 2}]}]
Attachments:
POSTED BY: Hadi Tokme
Hi, The syntax seemed to be missing the endpoint for the arrow. I was able to get a decent plot and annotations by changing only the "Epilog" option.
 Epilog->  {
(* Specify arrow *) Arrow[{{50000,0.4},{35000,0}}] ,
(* Specify text *) Inset[Style["Subscript[y, f]",20],{50000,0.5}] (* Close Epilog *)}                                                                                                                                                                   
POSTED BY: Isaac Abraham
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract