Re: Combining ListPlots
- To: mathgroup at smc.vnet.net
- Subject: [mg8090] Re: Combining ListPlots
- From: tburton at cts.com (Tom Burton)
- Date: Tue, 5 Aug 1997 03:23:01 -0400
- Organization: Brahea Consulting
- Sender: owner-wri-mathgroup at wolfram.com
On 4 Aug 1997 02:19:46 -0400, "Greg Keogh" <greg at werple.net.au> wrote:
>Hello from Melbourne Australia,
>
>I want to display two or more joined ListPlots on top of each
>other. My problem is that each of the individual ListPlots is
>being displayed before the combined one. I can't figure out how
>to suppress display of the individual plots.
>
>The real tables I'm plotting are actually from a complicated
>optical system, but for the purposes of illustration the
>following tiny sample using PrimePi and LogIntegral is almost
>identical to what the real program is doing:
>
>plot1 = Table[{x,PrimePi[x]},{x,2,50}];
>plot2 = Table[{x,LogIntegral[x]},{x,2,50}];
>Show[ListPlot[plot1,PlotJoined->True],ListPlot[plot2,PlotJoined->True]]
>
>This produces three ListPlots, the individual ones for plot1 and
>plot2, then the combined one appears.
>
>What is the neatest way of producing a single combined ListPlot?
>
>Cheers,
>Greg Keogh
><greg at werple.net.au>
>
>Ps. Please cc replies to my email address, we check the mail frequently.
The neatest way is probably
In[4]:= Needs["Graphics`Graphics`"]
In[5]:= DisplayTogether[ListPlot[plot1,PlotJoined->True],
ListPlot[plot2,PlotJoined->True]];
This a short cut masking what is really going on: temporarily opting
DisplayFunction->Identity to suppress the display as the two individual plots are restored, and then restoring the option to the default DisplayFunction->$DisplayFunction. Thus, the explicit way to do this is to add the first option to both ListPlots and the latter option to Show.
Tom Burton