# How to Create an Empty(ish) Graph to Overlay Graphs on using Show?

I hobbled together a For loop to create a series ListLinePlots and appended them to a list to display them with the Show function.

My problem is I have no control over the images viewable domain and range because I can't seem to modify the viewing range and domain of a ListLinePlot image.

I tried the PlotRange-> options(All, Full and Automatic) but Show only takes into account the viewing range and domain of the first image so I can't see that being a fix.

My current idea is to create a plot with the viewable domain and range I want and have it as the first element in the list I use Show on but I can't seem to think how to make an empty(ish) plot that allows me modify the range and domain to the values I need. Does any one have any suggestions of an non-intrusive graph to plot that would work?

Thank you in advanced for any help, Bright

• Hi, welcome to mathematica.SE :) Could you provide a minimal example of plots?
– Kuba
Dec 4 '14 at 8:06
• All the line plots with the ListLinePlots function have a magnitude of 1. They are all in each one of four directions: Up, Down, Left, Right. This sadly makes the result of the Show function a 1 by 1 image centered at the point (0.5, 0.5) even when some ListLinePlots are graphed outside of that 1 by 1 viewing window. I'll get some images posted in 9 to 10 hours(no internet connect on the computer in question at the moment). Dec 4 '14 at 8:36
• The Show function only uses the viewing range and domain of the first ListLinePlot in the list and what the first ListLinePlot considers to be All is only part of the overall picture when you look at all the ListLinePlots overlaid on one another. Dec 4 '14 at 17:05

dt = Table[Transpose[{Range[ri = RandomChoice[Range[10, 80, 20]], ri + 99],
Accumulate[RandomReal[{-1, 1}, 100]]}], {6}];

llps = (i = 1; ListLinePlot[#, BaseStyle -> Thick, AxesOrigin -> {0, 0}, ImageSize -> 300,
PlotStyle -> ColorData[63, "ColorList"][[i++]]] & /@ dt);

Row[llps, Spacer[5]]


how to make an empty(ish) plot that allows me modify the range and domain to the values I need

emptyllpF = ListLinePlot[{1}, PlotRange -> #, PlotStyle -> None,
BaseStyle -> Thick, AxesOrigin -> {0, 0}, ImageSize -> 400] &;
emptyllpF@{{0, 250}, {-20, 20}}


Prepend the empty plot to the list of plots and use with Show:

Show[Prepend[llps, emptyllpF@{{0, 250}, {-20, 20}}]]


Or use a PlotRange that covers the ranges of all plots:

prange = (Through@{Min, Max}@#) & /@ (Transpose[PlotRange /@ llps])
(* {{0., 169.}, {-9.32038, 8.01998}} *)

Show[Prepend[llps, emptyllpF@prange]]


I tried the PlotRange-> options(All, Full and Automatic) but ...

Show[..., PlotRange->All] should work.

Show[llps, PlotRange -> All, ImageSize -> 400]


You can also set the PlotRange explicitly:

Example 1: Use {{0, 250}, {-20, 20}} as the setting for PlotRange:

Show[llps, PlotRange -> {{0, 250}, {-20, 20}}, ImageSize -> 400]


Example 2: Use the PlotRange setting of the second plot for the overlayed plots:

Show[llps, PlotRange -> PlotRange[llps[[2]]], ImageSize -> 400]


Example 3: Use a PlotRange that covers the ranges of all plots:

Show[llps, PlotRange -> prange, ImageSize -> 400]


• Thank you!! Your emptyllpF graph looks very promising, it certainly is better than my latest idea to plot 4 points such that it makes a square around the area I want to view and have that as my first image in the list I use the Show function on. Dec 4 '14 at 17:07
• @BrightHalo, glad you found it useful. Still think PlotRange->All is much easier. How come it doesn't work in your use cases? Btw, welcome to mma.se.
– kglr
Dec 4 '14 at 17:11
• Thank you so much! This was the last thing I needed before being able to finish a function that plots fractals. The PlotRange-> All wasn't working because the first graph is a line from {0,0} to {1,0} and Mathematica auto sets the viewing range based on seeing that line(even with PlotRange->All) and the Show function uses the viewing range of the first graph you give it. So even if the second graph is a line from {1,0} to {10000,0} the Show function will use the viewing range optimized to see the line from {0,0} to {1,0}. Dec 5 '14 at 7:17