MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Show graphics command

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40370] Re: [mg40347] Show graphics command
  • From: Murray Eisenberg <murraye at attbi.com>
  • Date: Thu, 3 Apr 2003 01:42:28 -0500 (EST)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <200304020936.EAA10947@smc.vnet.net>
  • Reply-to: murray at math.umass.edu
  • Sender: owner-wri-mathgroup at wolfram.com

This sort of question must surely rank as one of the most-often asked!

You need to turn off normal display for the individual graphics objects, 
then turn in back on for the combined object using the DisplayFunction 
option.  For example:

   f[x_] := x
   data = Table[{n, n + Random[]}, {n, 0, 20}];

   pts = ListPlot[data, DisplayFunction -> Identity];
   (* no display is produced *)

   model = Plot[f[x], {x, 0, 20}, DisplayFunction -> Identity];
   (* no display is produced *)

   Show[pts, model, DisplayFunction -> $DisplayFunction];

Of course you can do all that in a single expression ...

   Show[ListPlot[data, DisplayFunction -> Identity],
        Plot[f[x], {x, 0, 20}, DisplayFunction -> Identity], \
       DisplayFunction -> $DisplayFunction];

... but that gets a bit hard to read.


Nathan Moore wrote:
> The list operations have been very useful.
> 
> Here's a pet peeve.  Often when I combine several graphics objects with
> the show command I get a bunch of extraneous plots.  Suppose I have a list
> of {x,y} pairs (named "data") and a fit function f[x] and I want to show
> them together.  The easiest way to do this is with the command,
> 
> Show[ListPlot[data],Plot[f[x],{x,0,Xo}]
> 
> When I execute this I get 3 plots, ListPlot[data], the Plot[f[x]], and
> then the tro combined.  How can I have the front end suppress the first
> two plots?  (this "error" is especially annoying when I'm plotting 7 or 8
> lists together)
> 
> Nathan Moore
> 
> 
> 

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street
Amherst, MA 01375



  • Prev by Date: Re: Import[ ] & ReadList[ ]; "Word" and "Record"
  • Next by Date: Re: mathematica question
  • Previous by thread: Re: Show graphics command
  • Next by thread: Re: Show graphics command