# How to plot against scaled axes?

Say I have some plot, such as:

Plot[Exp[-(x - 2)^2/(2*1^2)], {x, 0, 6}, AxesLabel -> {"x", "f(x)"}]


But I want to present it with the axis labeled as some scalar of a constant amount.

Suppose x represents a physical quantity (e.g. distance) and X=3.1 meters is a fundamental distance in this problem.

How can I change the axes in the plot so that the labels represent the value "x" in terms of "X"?

In other words, I would like for the plot to remain the same, but the previous location of the "1" tick would become ~0.323 (since 0.323*3.1 ~ 1), or a new "1" tick would appear slightly past the original location of the "3" tick.

How can I accomplish this (without changing the plot itself, only the axes representation).

• Tick labeling is particularly annoying in Mathematica, which is why I would suggest scaling x in your function instead. So, do Plot[Exp[-(3.1*x - 2)^2/(2*1^2)], {x, 0, 6/3.1}]. Dec 9, 2015 at 22:59

Plot[
Exp[-(x - 2)^2/(2*1^2)], {x, 0, 6},
Ticks -> {Transpose[{#, # .323}] &[Range@6], Automatic},
AxesLabel -> {"x", "f(x)"}]


I prefer the rescaled plot to show its x-axis ticks with normal Mathematica style divisions rather than have ticks that are multiples of the scale factor. It takes a little more work to do it that way, but I think it is worth the extra effort.

Here is one way it can be done.

f[x_] := Exp[-(x - 2)^2/(2*1^2)]

With[{scaleFactor = .323, xmin = 0, xmax = 6},
Module[{divisions, xticks},
divisions =
FindDivisions[scaleFactor {xmin, xmax}, {Ceiling[scaleFactor xmax], 5}];
xticks = Transpose[{# /scaleFactor, #}]&[N[Union @@ divisions[[2]]]];
Plot[f[x], {x, xmin, xmax},

As you can see from the vertical red line, the unscaled value of x = 3 falls very close to the scaled value 1 as expected.