MathGroup Archive 2008

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

Search the Archive

Re: How do I create my own color gradient?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92535] Re: How do I create my own color gradient?
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Fri, 3 Oct 2008 06:41:16 -0400 (EDT)
  • References: <gc3j51$sah$1@smc.vnet.net>

Tyler wrote:
> Hi All:
> 
> Kinda of a silly question, but I've been banging head against the wall
> for the past two nights. I am trying to figure out how I can make my
> own colour gradient, analogous to Rainbow, AplineColors, &c.
> 
> Is there any standard framework around trying to create your own?
> Further, say I wanted one of the preexisting ones, but scaled
> exponentially, or set a particular value to bright yellow (to
> highlight that specific result). I used to use IDL quite a bit, and
> made use of these kinds of manipulations frequently.
> 
> Any ideas or references? I keep finding myself doing the same old loop
> in the Documentation Center, from ColorData, to ColorFunction, and so
> on, and so on.....

the gradients are in the form of ColorFunctions. As almost everything
these are normal mathematica expressions that you can handle just like
any other expression. You can look at the FullForm of these to see the
data they contain:

ColorData["Rainbow"] // FullForm

What you will see is that it basically contains a pure function which
encapculates a Blend. With that information, adoptions and constructions
of own color functions should be simple:

mycolorfun=Function[Blend[{Red,Green,Blue},#]]

this will change an existing colorfunction:

newfun = ColorData["Rainbow"] /.
  RGBColor[0.513417`, 0.72992`, 0.440682`] -> RGBColor[1, 1, 1]

since there is additional information used for the formatting that is
not updated within the ColorFunction-Object, you might want to extract
the pure functions and work with only those:

newfun = ColorData["Rainbow"] /.
  RGBColor[0.513417`, 0.72992`, 0.440682`] -> RGBColor[1, 1, 1]

hth,

albert


  • Prev by Date: Re: Automating file names in exporting data
  • Next by Date: Re: RE: Comparison between Mathematica and other
  • Previous by thread: Re: How do I create my own color gradient?
  • Next by thread: Re: How do I create my own color gradient?