MathGroup Archive 2003

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

Search the Archive

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

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

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.)


    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.

    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.


    {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

From: AES/newspost [mailto:siegman at]
To: mathgroup at

I'll still assert that something like:


        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

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

  • 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