Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Colors?' topicStudent Support Forum > General > "Colors?"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Henry Lamb
10/16/04 11:45pm

The range of your plotted function is automatically scaled to the range (0, 1). If you want to use Hue, write a function which maps the range of hues to this range.

For example, if you want to plot Sin[x y], and have violet (Hue[.9]) represent the lowest value and red (Hue[0]) represent the highest value, you can do it like this.

ContourPlot[Sin[x y], {x, -Pi, Pi}, {y, -Pi, Pi}, ColorFunction -> (Hue[.9(1 - #]&)];

If you want to use the three-parameter version of Hue, write a function for each of the hue, saturation, and brightness. Here's an example.

ContourPlot[Sin[x y], {x, -Pi, Pi}, {y, -Pi, Pi}, ColorFunction -> (Hue[.75(1 - #), 1 - 1.25(# - 0.5)^2, 1 - 4(# - 0.5)^4]&)];

If you prefer to use RGBColor, do it the same way, with a function for each of Red, Green, and Blue. Be sure that the value of each function falls within the bounds (0, 1) on the domain (0, 1).


URL: ,

Subject (listing for 'Colors?')
Author Date Posted
Colors? Toe-Knee 09/29/04 7:06pm
Re: Colors? Henry Lamb 10/16/04 11:45pm
Re: Colors? Toe-Knee 10/17/04 11:01pm
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic