MathGroup Archive 2000

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

Search the Archive

RE: Amazing backgrounds

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25214] RE: [mg25196] Amazing backgrounds
  • From: "David Park" <djmp at earthlink.net>
  • Date: Fri, 15 Sep 2000 02:21:48 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Gregorio,

I am not certain about how to make the entire background graded in color,
but it is certainly possible to make the region within the Frame, say,
graded. Here is an example. Here the whole plot is put on a Linen
background, but the Frame region is graded from one color to another. The
FilledPlot package is needed to get the AxesFront option, which WRI really
ought to make a standard option for Graphics.

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

This routine generates a graded color between two colors as the var goes
from 0 to 1.

gradedcolor[color1_, color2_, var_] :=
  RGBColor @@ Chop[List @@ color1 + j(List @@ color2 - List @@ color1)]

This provides a graded plot background from Red to Yellow and plots a sin
wave on top of it:

g1 = First[Plot[Sin[x], {x, 0, 2*Pi}, DisplayFunction -> Identity]];
With[{xmin = -0.01, ymin = -1.01, xmax = 2*Pi, ymax = 1.01},
   Show[Graphics[{RasterArray[Table[gradedcolor[Red, Yellow, j], {i, 0, 1,
1},
        {j, 0, 1, 0.005}], {{xmin, ymin}, {xmax, ymax}}], g1}],
    PlotRange -> {{xmin, xmax}, {ymin, ymax}}, Background -> Linen,
    {Frame -> True, FrameLabel -> {x, y}, PlotLabel -> "Graded Background",
     AxesFront -> True, ImageSize -> 500}]];

This provides a graded plot background from LightBlue to Pink:

g1 = First[Plot[Sin[x], {x, 0, 2*Pi}, DisplayFunction -> Identity]];
With[{xmin = -0.01, ymin = -1.01, xmax = 2*Pi, ymax = 1.01},
   Show[Graphics[{RasterArray[Table[gradedcolor[LightBlue, Pink, j], {i, 0,
1, 1},
        {j, 0, 1, 0.005}], {{xmin, ymin}, {xmax, ymax}}], g1}],
    PlotRange -> {{xmin, xmax}, {ymin, ymax}}, Background -> Linen,
    {Frame -> True, FrameLabel -> {x, y}, PlotLabel -> "Graded Background",
     AxesFront -> True, ImageSize -> 500}]];

You should be able to use any picture you can build up as a RasterArray as a
background to the plotted region.

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

> -----Original Message-----
> From: Gregorio Ferzio [mailto:moonbloody at lycos.com]
To: mathgroup at smc.vnet.net
> Hallo
>
> Using Background option in Plot we can obtain monocromatic
> background only.
> Is there a way to draw a plot over a shaded background ? It' s to
> say over a background, as an example, spamming from red on the
> left to yellow on the rigth.
>
> Regards
> Gregorio Ferzio
>




  • Prev by Date: Re: Mapping down two lists
  • Next by Date: Re: Re: PseudoInverse for exact matrices: Comments...
  • Previous by thread: Re: Amazing backgrounds
  • Next by thread: Mapping down two lists