Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*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 2000

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

Search the Archive

Re: More Epilogs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23684] Re: More Epilogs
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Mon, 29 May 2000 12:24:12 -0400 (EDT)
  • References: <8gso7v$efd@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"F. Mittermayr" <mitterma at linz.vai.co.at> wrote in message
news:8gso7v$efd at smc.vnet.net...
> Hi,
> does anyone know how to combine 2 plots with 2 epilogs in a Show command??
>
>
> p1=Plot[Sin[x], {x,0,2 Pi}, Epilog->
{PointSize[0.05],Hue[1],Point[{0,1}]},
> DisplayFunction->Identity];
> p2=Plot[Cos[x], {x,0,2 Pi}, Epilog->
{PointSize[0.05],Hue[1],Point[{0,0}]},
> DisplayFunction->Identity];
> Show[p1,p2,DisplayFunction->$DisplayFunction]
>
> unfortunately only one Epilog is plotted.
>
> Thnx for any ideas
> F. Mittermayr
>

In the final Show, Mathematica ignores the Epilog from p2 - not only is it not
shown, it does not appear in the code. This is consistent with the idea of
options being overidable.

Two suggestions,
1) instead of using Epilog use, for example,

p1 = {Plot[Sin[x], {x, 0, 2 Pi}, DisplayFunction -> Identity],
      Graphics[{PointSize[0.05], Hue[1], Point[{0, 1}]}]};
p2 = {Plot[Cos[x], {x, 0, 2 Pi}, DisplayFunction -> Identity],
      Graphics[{PointSize[0.05], Hue[1], Point[{0, 0}]}]};
Show[p1, p2, DisplayFunction -> $DisplayFunction]

2) If necessary use a helper function to consilidate Epilog:

ConsolidateEpilog[h_[s_, opts___]] :=
  h[Append[Flatten[{s}], Epilog /. Flatten[{opts}]],
    DeleteCases[Unevaluated[opts], Epilog -> _, {0, Infinity}]]

p1 = ConsolidateEpilog[
      Plot[Sin[x], {x, 0, 2 Pi},
        Epilog -> {PointSize[0.05], Hue[1], Point[{0, 1}]},
        DisplayFunction -> Identity]];
p2 = ConsolidateEpilog[
      Plot[Cos[x], {x, 0, 2 Pi},
        Epilog -> {PointSize[0.05], Hue[1], Point[{0, 0}]},
        DisplayFunction -> Identity]];
Show[p1, p2, DisplayFunction -> $DisplayFunction]

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565





  • Prev by Date: RE: More Epilogs
  • Next by Date: Re: checking for a dead MathLink connection
  • Previous by thread: RE: More Epilogs
  • Next by thread: Re: PSLQ and Mathematica 4.0