I'd like to plot a list of the following form with a customized scale

data=ConstantArray[1, 1000]

The scale of x-axis is kind of non-linear. The first 500 observations of the data has a distance 1. The next 300 observations have distance 3 from each other. Lastly, the last 200 observations have distance 10.

How can I scale x-axis of ListPlot to reflect such changing distances?

  • $\begingroup$ I don't understand. most ListPlot[s are of paired data sets, so producing 3 kinds of 2-tuples, would be the first part of your question. However, different scaling a single graph, seems unlikely. ** Unless, you ListPlot 3 different data sets, and merge the graphs? I'm lost at that too. $\endgroup$
    – prog9910
    May 21, 2020 at 2:06
  • $\begingroup$ A dataset list this? lst = Join[Map[{1, 1} &, Range[500]], Map[{2, 3} &, Range[501, 800]], Map[{3, 10} &, Range[801, 1000]]]; ListPlot[%, Joined -> True] ** There is this MMA example, too. reference.wolfram.com/language/howto/… $\endgroup$
    – prog9910
    May 21, 2020 at 2:14

2 Answers 2


I will try to do exactly what you asked, which can be seen from the gridlines of x-axis. I will use range $50,80,100$ so you can actually see distances between the points (too many points overlap visually and look like a line). You can easily generalize to your range (500,800,1000). First define a scaling function:

scale[x_]:=Piecewise[{{x,x<50},{x 2-50,50<=x<80},{x 3-50-80,80<=x}}]

Now with your data

data = ConstantArray[1, 100];

the plot scaling functions works as $\{f,f^{-1}\}$ setting:


enter image description here

In the docs on ScalingFunctions this general form of arbitrarily defined scaling is mentioned in the details:

enter image description here


You could generate your own abscissa list according to your specifications:

abscissae = Join[
     Range[503, 299*3 + 503, 3], 
     Range[1410, 1410 + 199*10, 10]


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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