# Varied PlotRange for plots combined using Show

I would like to create a so called Stacked Plot type of view to display a combination of data. Perhaps there already is a built in function in Mathematica, but I didn't manage to find it. So, I decided to simply shift the X and Y axis values of plots by a certain value and combine them using Show. So, here is the example code how I tried to do it:

Do[
Subscript[data, i] = Table[{x, Sin[x + i] + 2*i}, {x, 0, 10, 0.1}];
Subscript[lpl, i] = ListLinePlot[Subscript[data, i], PlotRange -> {{0 + 0.1*i, 10 - 0.1*(10 - i)}, {-1.2, 22.2}}]
, {i, 0, 10}];
Show[Table[Subscript[lpl, i], {i, 0, 10}], Axes -> None, Frame -> {{None, None}, {True, None}}, PlotRange -> {{-0.1, 10.1}, {-1.2, 22.2}}]


You can see, that I shifted the x values of PlotRange of each consequent plot by a certain value. However, in the output all of the plots seem to have the same PlotRange values. So the resultant output looks pretty rectangular, like this: So, here are the questions:

1. Is it possible to combine several ListLinePlots having different PlotRange values using Show so, that they retain their individual PlotRanges, i.e. will be clipped in a combined plot?
2. Perhaps there is another, better solution to make a Stacked Plot? Here is an example of how a Stacked plot I am aiming for looks like: ## 2 Answers

data = Table[{x, i, Sin[x + i]}, {i, 0, 10}, {x, 0, 10, 0.1}];

ListPointPlot3D[Evaluate@data] Graphics3D[{AbsoluteThickness[3.25],
Transpose[{
Table[ColorData[n], {n, Length[data]}],
Line /@ data}]},
BoxRatios -> {1, 1, 1/2},
Axes -> True] • Thank you, @BobHanlon! Is it possible to change the displayed plot range of one of the axes in the second solution (with Graphics3D?) – Bulat Munavirov Oct 23 '17 at 7:27
• Sorry for the dummy question, I found how to tune the plot range, it is pretty straightforward. Your solution works for me! A bit slow since the data is huge (an array of 3x32x32168 data points in my case), but I guess there is no way to make it faster. Or is there? – Bulat Munavirov Oct 23 '17 at 7:46

If I understand you right (if not, please let me know, and will delete this), you want to combine the plots but each have it own plot range.

I would not use Show. Just use ListLinePlot. Show takes information from the first graphic object it is given. So I would simply do

Do[data[i]=Table[{x,Sin[x+i]+2 i},{x,0+0.1 i,10-0.1 (10-i)}],{i,0,10}];
ListLinePlot[data[#]&/@Range[0,10]] ps. I changed your subscripts with indexed, as it is easier to type for me.

• It is indeed one way to achieve the result, but it involves manipulation of data. As one consequence, in this particular example, the number of data points in your code and mine is different -- each curve in my plot consist of 101 data point, in yours -- only 10. I understand that your code can be modified so that we have equal data sizes. But perhaps there is a way to do it without data manipulation? It is that in real application data sizes are quite huge. Usually I need to make a stack of more than 10 plots with 32k points each. – Bulat Munavirov Oct 22 '17 at 15:58