1
$\begingroup$

I have this function:

f[x] := -29.9092 + 0.456839 x 

Now I plot it:

Plot[f[x],{x,120,150}]

If I want to highlight a specfic point:

 x1 = {{130,f[130]}}

I would like to have a vertical line going from the x-Axis to that point and ending at that point (like: Filling -> Bottom) and a horizontal line going from the y-Axis and ending at that point.

How can I do it ?

$\endgroup$

closed as off-topic by Feyre, march, happy fish, Öskå, MarcoB Mar 31 '17 at 7:20

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Feyre, march, happy fish, Öskå, MarcoB
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    $\begingroup$ Epilog->Line[{{130,0},{130, f[130]}}] $\endgroup$ – David G. Stork Mar 29 '17 at 18:13
3
$\begingroup$

This can be accomplished using ListLinePlot in combination with the original Plot:

f[x_] := -29.9092 + 0.456839 x

Show[Plot[f[x], {x, 120, 150}], 
 ListLinePlot[{{{120, f[130]}, {130, f[130]}}, {{130, f[120]}, {130, 
     f[130]}}}, PlotStyle -> Red]]

enter image description here

You can also can also get the same effect using @DavidGStork suggestion:

Plot[f[x], {x, 120, 150}, 
 Epilog -> {Line[{{130, f[120]}, {130, f[130]}}], 
   Line[{{120, f[130]}, {130, f[130]}}]}]

enter image description here

$\endgroup$
  • $\begingroup$ Great !! Thanks ! :) $\endgroup$ – henry Mar 29 '17 at 18:15
  • 4
    $\begingroup$ Line[{{130, f[120]}, {130, f[130]}, {120, f[130]}}] should also work and is simpler. $\endgroup$ – anderstood Mar 29 '17 at 18:19

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