0
$\begingroup$
    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["2 Sin(x)", Black, 10], {-1, -1}, {3.5, -26}], 
                  Text[Style["(-1,-1.68)", Black, 10], {-1, -1}, {-1.3, 6}], 
                   PointSize[0.017], Point[{-1, -1.68}]}, 
       FillingStyle -> Yellow, 
       Background -> LightGray]

Mathematica graphics

$\endgroup$
3
  • 2
    $\begingroup$ why did you delete your question here mathematica.stackexchange.com/questions/44062/… right after I answered it? $\endgroup$
    – Nasser
    Commented Mar 15, 2014 at 11:37
  • $\begingroup$ @Nasser That's not cool, user3395043. Nasser put in a lot of work, for free, to help you out. His receiving upvotes and your accepting the best answer are the only forms of compensation the SE model offers. Please respect that. $\endgroup$
    – Michael E2
    Commented Mar 15, 2014 at 14:31
  • $\begingroup$ @Nasser and Michael. I am so sorry. i am new here. I think im accidentally deleted the post. How to do upvote? i tried it but i cant because i dont have enough reputation. $\endgroup$
    – wayne
    Commented Mar 15, 2014 at 16:59

2 Answers 2

2
$\begingroup$

Use the Drawing Tools "Palette":

Mathematica graphics

$\endgroup$
1
  • $\begingroup$ Thanks but is there any code that we can use to create an arrow? i think if we can utilize "arrow" in documentation center, we might be able to sketch the arrow.. $\endgroup$
    – wayne
    Commented Mar 15, 2014 at 14:14
2
$\begingroup$

Here is an approach. It can be made more general,e.g, optional arguments to vary plot styling etc.

fun[f_, p0_, p1_, off_] := 
 Plot[f, {x, -2 Pi, Pi}, 
  PlotStyle -> {Dashing[0.0155], Thickness[0.006]}, 
  Ticks -> {{-2 Pi, -Pi, 0, Pi}, {1, 2}}, Filling -> Axis, 
  Epilog -> {Text[Style[f, Black, 10], p0 - off (p1 - p0)], 
    Arrow[{p0, p1}]}, FillingStyle -> Yellow, Background -> LightGray]

Now you can 'play' to chose position and arguments to achieve desired result:

Manipulate[
 Column[{Image[fun[g, p, {q, g /. x -> q}, o], ImageSize -> 400], p}],
 {{g, 2 Sin[x], "functions"}, {2 Sin[x], 
   Cos[x]}}, {{p, {-1, 1}}, {-2, -2}, {2, 2}}, {q, -2, 2, 
  Appearance -> "Labeled"}, {{o, 0.1, "offset"}, 0.1, 0.4, 
  Appearance -> "Labeled"}]

enter image description here

$\endgroup$
5
  • $\begingroup$ Thanks! it looks great but how do i insert the arrow command into my program? Please help me :( $\endgroup$
    – wayne
    Commented Mar 15, 2014 at 14:20
  • $\begingroup$ @user3395043 you can use Arrow just as you would use Line (I suggest looking at the documentation of both). fun in my answer takes the arguments: function you wish to plot, the point of tail of the arrow (p0), where you want the head of the arrow (p1) and the offset of the text. You could just copy and paste the contents of the function and supply your own arguments and play around. $\endgroup$
    – ubpdqn
    Commented Mar 15, 2014 at 14:28
  • $\begingroup$ I tried to add the Arrow command but it still cant produce the result.. this is my modified code.. 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["2 Sin(x)", Black, 10], {-1, -1}, {3.5, -26}], Text[Style["(-1,-1.68)", Black, 10], {-1, -1}, {-1.3, 6}], Arrow[{1, 2}, {2, 3}], PointSize[0.017], Point[{-1, -1.68}]}, FillingStyle -> Yellow, Background -> LightGray] $\endgroup$
    – wayne
    Commented Mar 15, 2014 at 14:32
  • $\begingroup$ @user3395043 I have altered your code. Your syntax for Arrow was incorrect. Needs to be Arrow{{{x0,yo},{x1,y1}}] Note extra {}. I have changed the coordinates of your text.Please look at code: 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["2 Sin(x)", Black, 10], {-1.2, 1.2}], Text[Style["(-1,-1.68)", Black, 10], {-1, -1}, {-1.3, 6}], Arrow[{{-1, 1}, {0.2, 2 Sin[0.2]}}], PointSize[0.017], Point[{-1, -1.68}]}, FillingStyle -> Yellow, Background -> LightGray] $\endgroup$
    – ubpdqn
    Commented Mar 15, 2014 at 14:41
  • $\begingroup$ Thank you so much!! Really Appreciate it! $\endgroup$
    – wayne
    Commented Mar 15, 2014 at 16:55

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.