1
$\begingroup$

I'm trying to display a Graphics line alongside my Manipulate plot but I can't seem to do it because the Graphics and the Plot do not show up together.

Basically, I want to show this line

Graphics[{Dashed,Line[{{0,2974.83},{10,2974.83}}]}]

inside my Manipulate Plot where my Plot will be interactive and the line will also be there.

Here is my Manipulate Plot if that is helpful:

Manipulate[
    Plot[((5949.66-(0.669207*(471-bd)+0.068928*(bd)))/-10*t+5949.66),{t,0,10},
    AxesLabel->{"years from now", "billion Kg CO2eq"},
    PlotRange->All],
    {{bd,0,"Beef (dairy herd) factories converted"},0,417}
    ]

I have attached a picture of what I would want it to look like.enter image description here

I am pretty new to the software so any help would be greatly appreciated! Please let me know if I have mixed up something or need to clarify. Thanks!

$\endgroup$
3
  • 1
    $\begingroup$ see the examples in Show and in Epilog $\endgroup$ – kglr Dec 2 '20 at 22:53
  • 1
    $\begingroup$ see also GridLines $\endgroup$ – kglr Dec 2 '20 at 22:53
  • $\begingroup$ Epilog -> {Dashed, Line[{{0, 2974.83}, {10, 2974.83}}]} $\endgroup$ – cvgmt Dec 3 '20 at 1:57
1
$\begingroup$

Try adding GridLines to the Plot and a Control to move it up and down:

Manipulate[
 Plot[
  ((5949.66 - (0.669207*(471 - bd) + 0.068928*(bd)))/-10*t + 
    5949.66),
  {t, 0, 10},
  AxesLabel -> {"years from now", "billion Kg CO2eq"},
  PlotRange -> All,
  GridLines -> {None, {{gl, Dashed}}}
  ],
 
 {{bd, 0, "Beef (dairy herd) factories converted"}, 0, 417},
 {{gl, 1000, "GridLine"}, 500, 6000}
 ]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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