# Custom scaling of x-axis in ListPlot

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?

• 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. May 21, 2020 at 2:06
• 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/… May 21, 2020 at 2:14

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}}]


data = ConstantArray[1, 100];


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

ListPlot[data,ScalingFunctions->{{scale,InverseFunction[scale]},None},
PlotTheme->"Detailed",AspectRatio->1/7,GridLines->{Range[100],Automatic}]


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

abscissae = Join[