0
$\begingroup$

Here is my code and it works well:

{Slider[Dynamic[a], {-5, 5}], Dynamic[a]}
{Slider[Dynamic[b], {-5, 5}], Dynamic[b]}
Dynamic[Plot[Evaluate[y /. Solve[x^2 + y^2 == 25, y]], {x, a, b}, 
  AspectRatio -> Automatic, PlotRange -> {{-20, 20}, {-20, 20}}, 
  PlotLegends -> "Expressions"]]

after moving sliders output like:

enter image description here

So first slider (a variable) shows start value on the x axis, and second slider (b) shows end value on x axis. Now I need also to display dynamically start and end values of y axis outside of the plot (it maybe separate cell with Dynamic[]). How Can I add it? Please provide solution with Dynamic[] and not Manipulate[].

$\endgroup$
6
  • $\begingroup$ Will Epilog work? $\endgroup$
    – Kuba
    Commented Jul 12, 2020 at 6:14
  • $\begingroup$ @Kuba Thank you for asking. Yes, but if you know simpler solution it will be preferable. My goal is just do interactive plots as fast as possible for my personal use in order to better understand math. I do not need good styling, faster and easier way is preferable. $\endgroup$
    – vasili111
    Commented Jul 12, 2020 at 6:19
  • $\begingroup$ If you want to display additional numbers on the axis then try Epilog + Text/Inset. $\endgroup$
    – Kuba
    Commented Jul 12, 2020 at 7:24
  • $\begingroup$ Doesn't removing the PlotRange option get you what you want? A dynamically resizing plot. $\endgroup$
    – Edmund
    Commented Jul 12, 2020 at 10:53
  • $\begingroup$ @Edmund No, I need fixed sized plot. I need to also display dynamically calculated values. And those vales can be located at any place, not on the plot itself (I edited and corrected my question) $\endgroup$
    – vasili111
    Commented Jul 12, 2020 at 15:45

1 Answer 1

1
$\begingroup$

This I think works:

{Slider[Dynamic[a], {-5, 5}], Dynamic[a]}
Dynamic[Evaluate[y /. Solve[a^2 + y^2 == 25, y]]]
{Slider[Dynamic[b], {-5, 5}], Dynamic[b]}
Dynamic[Evaluate[y /. Solve[b^2 + y^2 == 25, y]]]
Dynamic[Plot[Evaluate[y /. Solve[x^2 + y^2 == 25, y]], {x, a, b}, 
  AspectRatio -> Automatic, PlotRange -> {{-20, 20}, {-20, 20}}, 
  PlotLegends -> "Expressions"]]
$\endgroup$

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.