I am plotting

f[x_] := 2*x + 1
Plot[f[x], {x, -10, 10}]

BUT I want to scale my axes differently. By default it is 1:2 , meaning 1 unit on $y$ axis is equal to 2 units on $x$ axis. I want to manually specify it. I tried to use AspectRatio, but this only changes my graph, and not the axes... What can I do?

  • $\begingroup$ It is not clear to me what your result should actually look like. Do you want to essentially relabel the axis or actually change the proportion of the plot? How you wish your scaling factor to interact with AspectRatio? $\endgroup$
    – Mr.Wizard
    Sep 21, 2014 at 9:53
  • $\begingroup$ I want to change the proportion of the plot. I want to have the same unit on both axes. For example: If my x axis is in m (meters) and y also in m (meters) I would like to see how the graph looks like if I change the y to km (kilometers) while x stays in m (meters). I hope you understand me now. $\endgroup$
    – skrat
    Sep 21, 2014 at 10:08
  • $\begingroup$ I posted an answer. Please review it and use it as a reference for additional clarification if necessary. $\endgroup$
    – Mr.Wizard
    Sep 21, 2014 at 10:10

1 Answer 1


I could interpret this question a couple of different ways. One is that you would like to scale the proportion of your plot. One can use ScalingFunctions (though undocumented for Plot) to specify the intended relationship, which will be correctly handled with AspectRatio -> Automatic. For example:

 Plot[3 Sin[2 x], {x, 0, 7}, ScalingFunctions -> {scale, Identity}, 
  AspectRatio -> Automatic, PlotRange -> All],
 {scale, {{2 # &, #/2 &}, Identity, {#/2 &, 2 # &}}}
] // GraphicsRow

enter image description here

Note that unlike setting the proportion using a specific value for AspectRatio I did not have to manually calculate this value; it was computed automatically.

Another interpretation is that you wish to relabel one of the plot axes, easily done with a coefficient in the right place:

  Plot[3 Sin[2 x], {x, 0, 7}],
  Plot[(3 Sin[2 x])/2, {x, 0, 7}],
  Plot[3 Sin[2 (x/2)], {x, 0, 14}]

enter image description here

These two behaviors may be combined to produce most any scaling you desire.

  • $\begingroup$ Nice stuff, but I noticed you use ScalingFunctions -> {scale, Identity}. Simpler would be ScalingFunctions -> scale, or is there something I'm missing?. +1. $\endgroup$
    – RunnyKine
    Sep 21, 2014 at 11:09
  • $\begingroup$ @RunnyKine The output is not the same; try it. (At least in v10.0.1) $\endgroup$
    – Mr.Wizard
    Sep 21, 2014 at 11:11
  • $\begingroup$ You're right, so what is the difference? I noticed using it the way I specified gave results identical to, say e.g. ListLogPlot when I use {#&, Log@# &} as the scaling. $\endgroup$
    – RunnyKine
    Sep 21, 2014 at 11:14
  • $\begingroup$ @RunnyKine There are two issues here I think. First is that there are different forms for the option value: "{f,f^-1} use the scaling function f and its inverse f^-1" and "{s1, s2, ...} use several scaling functions si for direction i" so a direct substitution of ScalingFunctions -> scale in my code above will not work. The second issue is that even if I modify my Table iterator values to work with the shorter syntax the output still is not the same; the tick marks are different. I do not know why; I just assumed the "{f,f^-1}" format was needed internally. (continued) $\endgroup$
    – Mr.Wizard
    Sep 25, 2014 at 14:15
  • 1
    $\begingroup$ Notice how the tick marks produced by this vary undesirably from that shown in the first image in my answer above: Table[Plot[3 Sin[2 x], {x, 0, 7}, ScalingFunctions -> scale, AspectRatio -> Automatic, PlotRange -> All], {scale, {#/2 &, # &, 2 # &}}] // GraphicsRow $\endgroup$
    – Mr.Wizard
    Sep 25, 2014 at 14:16

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.