Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

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: [mg92543] Re: How do I create my own color gradient?
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Fri, 3 Oct 2008 06:42:44 -0400 (EDT)
  • Organization: University of Bergen
  • 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.....
> 

Some examples:

cbar[cfun_] :=
  DensityPlot[x, {x, 0, 1}, {y, 0, 1}, AspectRatio -> 1/7,
   Frame -> False, ColorFunction -> cfun]

A built-in gradient:

cbar["Rainbow"]

Custom gradient:

cbar[Blend[{Red, Green, Blue}, #] &]

Built-in gradient transformed with a power function:

cbar[ColorData["Rainbow"][#^4] &]


  • Prev by Date: could not get Simplified form
  • Next by Date: Re: Automating file names in exporting data
  • Previous by thread: Re: How do I create my own color gradient?
  • Next by thread: Re: How do I create my own color gradient?