# How do I change axes scale?

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?

• 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? Commented Sep 21, 2014 at 9:53
• 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. Commented Sep 21, 2014 at 10:08
• I posted an answer. Please review it and use it as a reference for additional clarification if necessary. Commented Sep 21, 2014 at 10:10

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:

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


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:

GraphicsRow[{
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}]
}]


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

• Nice stuff, but I noticed you use ScalingFunctions -> {scale, Identity}. Simpler would be ScalingFunctions -> scale, or is there something I'm missing?. +1. Commented Sep 21, 2014 at 11:09
• @RunnyKine The output is not the same; try it. (At least in v10.0.1) Commented Sep 21, 2014 at 11:11
• 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. Commented Sep 21, 2014 at 11:14
• @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) Commented Sep 25, 2014 at 14:15
• 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 Commented Sep 25, 2014 at 14:16