Plot Y-Range on Mathematica

Plot Y-Range on Mathematica
$\begingroup$

I have a plot that I would like to slightly manipulate in Mathematica. Here is the code I am entering:

Plot[{x, 2^x, log_2(x)}, {x, -1, 3}]

As you can see $x$, $2^x$, and $log_2(x)$ are all plotted on a basic plot between $x = -1$ and $x = 3$. The x-range was easy to restrict, but how can I also restrict the y-range?

Thank you for your time.

$\endgroup$

2 Answers

$\begingroup$

Ahh... got it. Use PlotRange -> {lowerY, upperY}

Plot[{x, 2^x, Log2[x]}, {x, -1, 3}, PlotRange -> {-2, 4}]

$\endgroup$
0
$\begingroup$

Thanks, but actually you have to also include the x domain in the PlotRange function...so:

Plot[{x, 2^x, Log2[x]}, {x, -1, 3}, PlotRange -> {{-1,3},{-2, 4}}]
$\endgroup$

Your Answer

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

Sophia Al-Mansoor
Author

Sophia Al-Mansoor

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.