# Change scale on a graph

I have a graph obtained using ListPlot. What I plot goes between -1000 and +75.

I would like to construct a graph showing the whole range, with a scale such that what is between 0 and 100 takes about the same place as what is between -1000 and 0. To have something like that (for the vertical axis): Would you have an idea I could use to avoid doing that "by hand"?

Thanks a lot.

• What if you add PlotRange -> All? – J. M.'s ennui Feb 3 at 14:00
• "What I plot goes between -1000 and +75" are you referring to the horizontal or vertical scale here? Can you show an example with code and data? – MarcoB Feb 3 at 14:01
• @J.M.: thanks a lot. I have included a figure to better illustrate what I want to do. – Laurent Simula Feb 3 at 14:27
• @MarcoB: thanks a lot. The range I was referring to was the vertical axis. I just added a figure I made to illustrate what I am trying to do. I hope it clarifies it. – Laurent Simula Feb 3 at 14:29
• @Laurent I think you might consider a log plot (e.g. ListLogPlot) after rescaling your data so it is no longer negative (e.g. by adding a positive constant to it?). I am also concerned that the readability of your proposed plot would be very poor: the reader's eye would be greatly deceived by your subtle and non-standard change in scale. – MarcoB Feb 3 at 15:33

## 1 Answer

Use the ScalingFunctions option

ClearAll["Global*"]

SeedRandom;

data = Table[{RandomReal, RandomReal[{-1000, 100}]}, {20}];

f = If[# > 0, 10 #, #] &;

ListPlot[data,
PlotRange -> {-1000, 100},
Ticks -> {Automatic,
Join[Range[0, 100, 20], Range[-1000, -200, 200]]},
ScalingFunctions -> {None, {f, InverseFunction[f]}}] • Great! Thank you so much for your help. This is perfect :-) – Laurent Simula Feb 4 at 8:44
• I have been trying to understand the code, and tried to make a few changes to it. How could I proceed if I wanted to keep the same scale for values of y = [- 100, 100] and the scale 1/10 for y = [-1000,-100] ? Thanks a lot. – Laurent Simula Feb 4 at 9:59
• Is f = If[# > -100, #, #/10] &;` what you want? – Bob Hanlon Feb 4 at 14:58