0
$\begingroup$

I want to plot a vertical line on a graph. The plot range on the graph ranges from 0 - 12. I want the vertical line at x-axis = 0.8, but the vertical height going from 0 to 7 only. I am not sure how to do this. I tried with gridlines but there seems no easy way around that.

$\endgroup$
5
$\begingroup$

You can use the option Epilog or Prolog to add graphics primitives (lines, points, texts, etc.) to your plot:

Plot[2 Pi + 2 Pi x Sin[6 Pi x], {x, 0, 1},  
 Epilog -> {Red, Line[{{.8, 0}, {.8, 7}}]}]

enter image description here

Plot[2 Pi + 2 Pi x Sin[6 Pi x], {x, 0, 1},  
 Prolog -> {Red, Line[{{.8, 0}, {.8, 7}}]}]

same picture

| improve this answer | |
$\endgroup$

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