0
$\begingroup$

How can I label the coordinates of the plotted graph? I want to label the coordinate of $(-1,-1)$.

Plot[2 Sin[x], {x, -2 Pi, Pi}, 
 PlotStyle -> {Dashing[0.0155], Thickness[0.006]}, 
 Ticks -> {{-2 Pi, -Pi, 0, Pi}, {1, 2}}, Filling -> Axis, 
 Epilog -> {PointSize[0.017], Point[{-1, -1.68}]}, 
 FillingStyle -> Yellow, Background -> LightGray]
$\endgroup$
5
  • $\begingroup$ Read the documentation for Plot. $\endgroup$
    – ciao
    Mar 15, 2014 at 7:01
  • $\begingroup$ I tried it and i got stucked.. I tried displayform but it brought me nowhere :( help me please $\endgroup$
    – wayne
    Mar 15, 2014 at 7:04
  • 1
    $\begingroup$ Please do not use the graphs-and-networks tag for plotting questions. That tag is for networks, as made clear by its name. $\endgroup$
    – Szabolcs
    Mar 15, 2014 at 15:13
  • $\begingroup$ Ok noted. im sorry. i just joined this awesome page :) $\endgroup$
    – wayne
    Mar 15, 2014 at 16:53
  • $\begingroup$ If your plot is not for a static use, e.g., in a print publication, then would it be sufficient to use a tooltip? Thus (with stripped down code for simplicity):Plot[Tooltip[{2 Sin[x], 2 Cos[x]}], {x, -2 Pi, Pi}] $\endgroup$
    – murray
    Mar 15, 2014 at 20:55

1 Answer 1

6
$\begingroup$

You were almost there.

 Plot[2 Sin[x], {x, -2 Pi, Pi}, PlotStyle -> {Dashing[0.0155], Thickness[0.006]}, 
  Ticks -> {{-2 Pi, -Pi, 0, Pi}, {1, 2}}, Filling -> Axis, 
  Epilog -> {Text[Style["label", Red, 14], {-1, -1}, {-1, 0}], PointSize[0.017], 
  Point[{-1, -1.68}]}, FillingStyle -> Yellow, Background -> LightGray]

Mathematica graphics

To label more points (you can change to make your own labels as needed)

pts = {{-1, -1}, {-2, -1.5}};
Plot[2 Sin[x], {x, -2 Pi, Pi}, PlotStyle -> {Dashing[0.0155], 
   Thickness[0.006]}, Ticks -> {{-2 Pi, -Pi, 0, Pi}, {1, 2}}, 
   Filling -> Axis, Epilog -> {Text[Style[ToString[#], Red, 14], #, {-1, 0}] & /@ pts,
   PointSize[0.017], Point[{-1, -1.68}]},FillingStyle -> Yellow, 
   Background -> LightGray]

Mathematica graphics

$\endgroup$
1
  • $\begingroup$ Thank you so much. what should i do if i want to label two points? $\endgroup$
    – wayne
    Mar 15, 2014 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.