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):

enter image description here

Would you have an idea I could use to avoid doing that "by hand"?

Thanks a lot.

  • $\begingroup$ What if you add PlotRange -> All? $\endgroup$ – J. M.'s ennui Feb 3 at 14:00
  • $\begingroup$ "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? $\endgroup$ – MarcoB Feb 3 at 14:01
  • $\begingroup$ @J.M.: thanks a lot. I have included a figure to better illustrate what I want to do. $\endgroup$ – Laurent Simula Feb 3 at 14:27
  • $\begingroup$ @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. $\endgroup$ – Laurent Simula Feb 3 at 14:29
  • 1
    $\begingroup$ @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. $\endgroup$ – MarcoB Feb 3 at 15:33

Use the ScalingFunctions option



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

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

 PlotRange -> {-1000, 100},
 Ticks -> {Automatic, 
   Join[Range[0, 100, 20], Range[-1000, -200, 200]]},
 ScalingFunctions -> {None, {f, InverseFunction[f]}}]

enter image description here

  • $\begingroup$ Great! Thank you so much for your help. This is perfect :-) $\endgroup$ – Laurent Simula Feb 4 at 8:44
  • $\begingroup$ 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. $\endgroup$ – Laurent Simula Feb 4 at 9:59
  • $\begingroup$ Is f = If[# > -100, #, #/10] &; what you want? $\endgroup$ – Bob Hanlon Feb 4 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.