Re: ColorFunction in DensityPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg14205] Re: ColorFunction in DensityPlot
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Wed, 7 Oct 1998 03:00:38 -0400
- References: <6u87rm$4p3@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Selwyn Hollis wrote in message <6u87rm$4p3 at smc.vnet.net>... >Let's say we're solving the heat equation on [0,1]x[0,1] numerically >with an initial temperature distribution with values in [0,1], and >we're displaying the solution with ListDensityPlot as it evolves over >time. How can one specify the ColorFunction option in ListDensityPlot >so that a temperature of 1 _always_ shows as red and a temperature of 0 >always shows as blue (with green, yellow, orange in between)? In other >words, I need a fixed mapping between function values and color. Selwyn, List density plot passes on to ColorFunction the grid values scaled so that the used PlotRange maps onto 0 to 1. So a simple way to achieve your immediate aim is with ListDensityPlot[temperatures PlotRange->{0,1},ColorFunction->(Hue[2/3(1-#)]&)] Allan, ---------------------- Alllan Hayes Mathematica Training and Consulting www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565