MathGroup Archive 2003

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

Search the Archive

RE: Re: filled plot on part of x-interval

  • To: mathgroup at smc.vnet.net
  • Subject: [mg44702] RE: [mg44664] Re: filled plot on part of x-interval
  • From: "David Park" <djmp at earthlink.net>
  • Date: Fri, 21 Nov 2003 05:13:23 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Suppose we want to split the plot into three portions so that the center
line will have the same plot points as the fill and not leave gaps. And
suppose that we want to label each of the three regions, specifying the
labels in each of the three plots. (I also changed your FilledPlot so one
actually does obtain a filled plot.)

Needs["Graphics`Graphics`"];
Needs["Graphics`Colors`"];
Needs["Graphics`FilledPlot`"];

DisplayTogether[
    Plot[Sin[x], {x, 0, 2}, PlotStyle -> Red,
      Epilog -> {Text["Left", {1, -0.2}]},
      ImageSize -> 450],
    FilledPlot[Sin[x], {x, 2, 8},
      Fills -> LightBlue,
      AxesFront -> True,
      Epilog -> {Text["Center", {5, 0.2}]}],
    Plot[Sin[x], {x, 8, 10}, PlotStyle -> Red,
      Epilog -> {Text["Right", {9, -0.2}]}]];

The resulting plot is not what one probably intended. Only the left Epilog
label was picked up. Also the AxesFront option was lost from the FilledPlot,
but not the Fills option. ImageSize was picked up because it was in the
first plot. In other words, overall plot options are only picked up from the
first plot in the DisplayTogether statement. The solution is either put them
all in the first plot, or remove them from the individual plots and put them
at the end.

DisplayTogether[
    Plot[Sin[x], {x, 0, 2}, PlotStyle -> Red],
    FilledPlot[Sin[x], {x, 2, 8},
      Fills -> LightBlue],
    Plot[Sin[x], {x, 8, 10}, PlotStyle -> Red],
    Epilog -> {Text["Left", {1, -0.2}], Text["Center", {5, 0.2}],
        Text["Right", {9, -0.2}]},
    AxesFront -> True,
    ImageSize -> 450];

The only advantage of DrawGraphics is that instead of dealing with various
plots and worrying about what options are picked up, you draw the graphical
elements directly and always put the overall plot options at the end.

Needs["DrawGraphics`DrawingMaster`"]

Draw2D[
    {Red, Draw[Sin[x], {x, 0, 2}],
      Black, FilledDraw[Sin[x], {x, 2, 8}, Fills -> LightBlue],
      Red, Draw[Sin[x], {x, 8, 10}],
      Black, Text["Left", {1, -0.2}],
      Text["Center", {5, 0.2}],
      Text["Right", {9, -0.2}]},
    Axes -> True,
    AxesFront -> True,
    ImageSize -> 450];

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



From: AES/newspost [mailto:siegman at stanford.edu]
To: mathgroup at smc.vnet.net

I'll still assert that something like:

    Needs["Graphics`Graphics`"];
    Needs["Graphics`Colors`"];
    Needs["Graphics`FilledPlot`"];

    DisplayTogether[
        FilledPlot[{Sin[x], Sin[x]}, {x,2,8}],
        Plot[Sin[x], {x,0,10}, PlotStyle->Red]];

is clear, simple, flexible, and readable -- and allows you to easily
modify the styles (linewidths, colors) of the different components of
the plot independently, as done here, and add additional stuff if you
like.

DisplayTogether is your friend -- haven't run into a headache with it
yet.



  • Prev by Date: RE: [Integrate] Why two results of same eq. are different?
  • Next by Date: Arg[JacobiSN + DrawContourLines
  • Previous by thread: RE: Re: filled plot on part of x-interval
  • Next by thread: Re: filled plot on part of x-interval