Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

RE: Combining plots

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48646] RE: [mg48618] Combining plots
  • From: "David Park" <djmp at earthlink.net>
  • Date: Wed, 9 Jun 2004 04:17:10 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Johan,

You have to turn the DisplayFunction back on in the Show statement.

a = ListPlot[{1, 2, 3}, DisplayFunction -> Identity];
b = ListPlot[{4, 5, 5}, DisplayFunction -> Identity];

Show[a, b, DisplayFunction -> $DisplayFunction,
    Prolog -> AbsolutePointSize[4],
    Frame -> True];

Or you could use the Block statement to temporarily reset $DisplayFunction.
I also add colors to the points.

Needs["Graphics`Colors`"]

Block[{$DisplayFunction = Identity},
    a = ListPlot[{1, 2, 3}, PlotStyle -> {AbsolutePointSize[4], Blue}];
    b = ListPlot[{4, 5, 5}, PlotStyle -> {AbsolutePointSize[4], Red}]];

Show[a, b, Frame -> True];

There is a package, DrawGraphics, at my web site that was specifically
designed to make it easy to combine various plot types more like a standard
drawing program. It automatically handles the DisplayFunction and extracts
the graphic primitives so curves, surfaces and other plot objects are on the
same level as Point, Line and the graphic directives. So with DrawGraphics
the above plot could be done...

Needs["DrawGraphics`DrawingMaster`"]

Draw2D[
    {AbsolutePointSize[4],
     Blue,
     ListDraw[{1, 2, 3}],
     Red,
     ListDraw[{4, 5, 5}]},
    Frame -> True];

The "Draw" statements are used just like the corresponding "Plot" statements
in Mathematica.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/


From: Johan [mailto:vdmeer at science.uva.nl]
To: mathgroup at smc.vnet.net

Hello all,


Suppose I wish to show a combined plot, for instance

a:=ListPlot[{1,2,3}]
b:=ListPlot[{4,5,5}]

using Show[a,b]

Now Mathematica draws 3 graphics, one of a, b and one of a and b
combined. I want to only see the third combined graph and not the first
two graphs. Is that possible?

I tried something with setting DisplayFunction to Identity in a and b,
but then Show doesn't show anything... Help!

Thanks!

Johan




  • Prev by Date: Re: Re: Where does Return return to?
  • Next by Date: Re: Combining plots
  • Previous by thread: Re: Combining plots
  • Next by thread: Re: Combining plots