MathGroup Archive 2009

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

Search the Archive

Re: Mapping colours in DensityPlot

  • To: mathgroup at
  • Subject: [mg104183] Re: [mg104139] Mapping colours in DensityPlot
  • From: Mark McClure <mcmcclur at>
  • Date: Thu, 22 Oct 2009 02:18:50 -0400 (EDT)
  • References: <>

On Wed, Oct 21, 2009 at 6:27 AM, SeekUp <seek.up.girl at> wrote:
> I am using the following command to do a DensityPlot in
> grayscale. The grayscale range is from 0-255, but I need
> to map my function to a grey-level maximum of 200. How do
> I define a new GrayLevel with a max gray level of 200?

I'm not quite clear what you mean when you say that the
"grayscale range is from 0-255".  In fact, all arguments
to the ColorFunction will automatically be scaled to be
between 0 and 1.  This is good, since that's what GrayLevel
expects.  Do you want to darken your picture so that the
lightest region has shade GrayLevel[200/255]?  If so, try

cf[c_] = GrayLevel[200*c/255];
DensityPlot[Exp[-(x^2 + y^2)], {x, -2, 2}, {y, -2, 2},
 ColorFunction -> cf]

Hope that helps,
Mark McClure

  • Prev by Date: Re: How to get data from solvin' numerically differential
  • Next by Date: Re: Mathematica blogs
  • Previous by thread: Mapping colours in DensityPlot
  • Next by thread: Re: Mapping colours in DensityPlot