# How to rescale the x axis?

Please suggest how to rescale the x axis by t0: I am trying to plot given the exponential below.

t0 = .002;
Plot[(1 - Exp[-t/t0]), {t, 0, .008}]


## ChartingFindTicks

Using the automatically generated scaled ticks:

t0 = .002;
Plot[(1 - Exp[-t/t0]), {t, 0, .008}, PlotRange -> All,
Ticks -> {ChartingFindTicks[{0, t0}, {0, 1}], Automatic}]


The function ChartingFindTicks[{a, b}, {c, d}][min, max] generates the major and minor ticks based on the automatically computed minimum and maximum of the values on the axis using the parameters {a, b}, {c, d} for rescaling.

ChartingFindTicks[{0, t0}, {0, 1}][0, .008 ]


{{0., 0}, {0.002, 1}, {0.004, 2}, {0.006, 3}, {0.008, 4},
{0., "", {0.005, 0.}, {Thickness[0.001]}},
{0.0004, "", {0.005, 0.}, {Thickness[0.001]}},
{0.0008, "", {0.005, 0.}, {Thickness[0.001]}},
{0.0012, "", {0.005, 0.}, {Thickness[0.001]}},
{0.0016, "", {0.005, 0.}, {Thickness[0.001]}},
{0.002, "", {0.005, 0.}, {Thickness[0.001]}},
{0.002, "", {0.005, 0.}, {Thickness[0.001]}},
{0.0024, "", {0.005, 0.}, {Thickness[0.001]}},
{0.0028, "", {0.005, 0.}, {Thickness[0.001]}},
{0.0032, "", {0.005, 0.}, {Thickness[0.001]}},
{0.0036, "", {0.005, 0.}, {Thickness[0.001]}},
{0.004, "", {0.005, 0.}, {Thickness[0.001]}},
{0.004, "", {0.005, 0.}, {Thickness[0.001]}},
{0.0044, "", {0.005, 0.}, {Thickness[0.001]}},
{0.0048, "", {0.005, 0.}, {Thickness[0.001]}},
{0.0052, "", {0.005, 0.}, {Thickness[0.001]}},
{0.0056, "", {0.005, 0.}, {Thickness[0.001]}},
{0.006, "", {0.005, 0.}, {Thickness[0.001]}},
{0.006, "", {0.005, 0.}, {Thickness[0.001]}},
{0.0064, "", {0.005, 0.}, {Thickness[0.001]}},
{0.0068, "", {0.005, 0.}, {Thickness[0.001]}},
{0.0072, "", {0.005, 0.}, {Thickness[0.001]}},
{0.0076, "", {0.005, 0.}, {Thickness[0.001]}},
{0.008, "", {0.005, 0.}, {Thickness[0.001]}}}

Another example:

Plot[(1 - Exp[-t/t0]), {t, 0, 5 (.008)}, PlotRange -> All,
Ticks -> {ChartingFindTicks[{0, t0}, {0, 1}], Automatic}]


Update 1: How to use it when Frame-> True

Plot[(1 - Exp[-t/t0]), {t, 0, .008}, PlotRange -> All, Frame -> True,
FrameTicks -> {{Automatic, Automatic}, {ChartingFindTicks[{0, t0}, {0, 1}], Automatic}}]


Update 2:

Can you suggest about, if I want to find the time constant by taking the log of the plot

Pretending you don't know t0, extract the point coordinates from Plot output and use FindFit or Solve to find the scaling parameter:

plot = Plot[(1 - Exp[-t/t0]), {t, 0, .008}];
coords = Cases[plot, Line[x_] :> x, Infinity][[1]];

a /. FindFit[coords, 1 - Exp[-x/a], {a}, x]


0.002

a /. Quiet @ Solve[(#2 == 1 - Exp[-#/a]), a, Reals][[1]] & @@ coords[[1]]


0.002

• Thanks@kglr, Does it work for both axis? Feb 6, 2018 at 19:58
• @GopalVerma, my pleasure. It does work for all axes. (In 3D too)
– kglr
Feb 6, 2018 at 19:59
• good. Can u suggest about , If I want to find the time constant by taking the log of the plot. Feb 6, 2018 at 20:17
• Also, above ticks does not if use Frame-> True. Feb 6, 2018 at 20:34
– kglr
Feb 6, 2018 at 20:50

I think that you only have to modify your ticks labels:

t0 = .002;
Plot[(1 - Exp[-t/t0]), {t, 0, .008}, PlotRange -> All,
Ticks -> {Table[{i, (i/t0)}, {i, 0, 0.008, 0.001}], Automatic}]


• Thanks@ Navas, It is sufficient. Feb 6, 2018 at 19:55
• But, It is not working when I use Frame->True. Feb 6, 2018 at 20:22
• Use FrameTicks instead... Feb 6, 2018 at 20:24
• yes, It is working. Feb 6, 2018 at 20:36