1
$\begingroup$

I want to plot the following function.

f(r) = 1 - $\frac{10}{r}$ e$^{-\frac{0.7^2}{10 r}}$.

I can specify x-axis range using

Plot[f[r],{r,0,20}]

For the above input, in the output, mathematica is showing a plot in which y axis range is from 1 to -5, with step size of 1. I want y axis range from 1 to -30 with step size of 5. How to do that ?

$\endgroup$

1 Answer 1

5
$\begingroup$

It's not the "stepsize", try PlotRange

f[r_] := 1 - 10/r Exp[-( 7^2/(1000 r ))]
Plot[f[r], {r, 0, 20}, PlotRange -> {-30, 1}]

enter image description here

$\endgroup$
4
  • $\begingroup$ Thanks. It automatically came as I wanted. But I want to know how to do it manually. Forex, here on y-axis, the interval automatically came in units of 5. What if I want it in units of 10? $\endgroup$
    – apk
    Jun 5 at 16:34
  • 2
    $\begingroup$ If you want to change the spacing of the ticks on the y-axis from 5 to 10, you can use the Ticks option: Plot[f[r], {r, 0, 20}, PlotRange -> {-30, 1}, Ticks -> {Automatic, Range[-30, 1, 10]}] ticks documentation $\endgroup$
    – ydd
    Jun 5 at 17:27
  • $\begingroup$ I want to change the scaling. The distance, which is 5 units on the y-axis, I want the same distance to be 10 units. $\endgroup$
    – apk
    Jun 5 at 18:34
  • 1
    $\begingroup$ I am not sure what you mean. Do you want to the plot graphic to be half as tall as it is now relative to its width so that the same vertical distance on the screen is now 10 units instead of 5? In this case you can use the AspectRatio option. $\endgroup$
    – ydd
    Jun 5 at 21:44

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