Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4967 > unrolled thread

Coloring function

Started byguiwi <guillaume.witz@yahoo.com>
First post2011-09-15 08:40 +0000
Last post2011-09-16 09:57 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Coloring function guiwi <guillaume.witz@yahoo.com> - 2011-09-15 08:40 +0000
    Re: Coloring function "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-09-16 09:57 +0000

#4967 — Coloring function

Fromguiwi <guillaume.witz@yahoo.com>
Date2011-09-15 08:40 +0000
SubjectColoring function
Message-ID<j4sdle$sgv$1@smc.vnet.net>
Hi everybody. I have a general problem with the coloring method of
ColofFunction. Let's consider a plane of points that one wants to plot
with ListPointPlot3D. If I want to color the points according to their
x position, I write:

ListPointPlot3D[Flatten[Table[Table[{i, j, 0}, {j, -30, 30}], {i, -30,
30}], 1], ColorFunction -> Function[{x, y, z}, RGBColor[x, 0, 0]]]

and that indeed works. But if I want to color according to the
absolute value of x and use

ColorFunction -> Function[{x, y, z}, RGBColor[Abs[x], 0, 0]]

 the coloring is not symmetrical around the x=0 position, but
identical to the previous case. Another problem is to obtain a radial
coloring with

ColorFunction -> Function[{x, y, z}, RGBColor[x^2+y^2, 0, 0]]

where the origin of the radial coloring is not at {0,0} but somewhere
on the edge of the plot. Anyone knows how to control that coloring ?
Thanks.
Guillaume

[toc] | [next] | [standalone]


#5001

From"Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com>
Date2011-09-16 09:57 +0000
Message-ID<j4v6hu$c9p$1@smc.vnet.net>
In reply to#4967
On Thu, 15 Sep 2011 09:40:14 +0100, guiwi <guillaume.witz@yahoo.com> wrote:

> Hi everybody. I have a general problem with the coloring method of
> ColofFunction. Let's consider a plane of points that one wants to plot
> with ListPointPlot3D. If I want to color the points according to their
> x position, I write:
>
> ListPointPlot3D[Flatten[Table[Table[{i, j, 0}, {j, -30, 30}], {i, -30,
> 30}], 1], ColorFunction -> Function[{x, y, z}, RGBColor[x, 0, 0]]]
>
> and that indeed works. But if I want to color according to the
> absolute value of x and use
>
> ColorFunction -> Function[{x, y, z}, RGBColor[Abs[x], 0, 0]]
>
>  the coloring is not symmetrical around the x=0 position, but
> identical to the previous case. Another problem is to obtain a radial
> coloring with
>
> ColorFunction -> Function[{x, y, z}, RGBColor[x^2+y^2, 0, 0]]
>
> where the origin of the radial coloring is not at {0,0} but somewhere
> on the edge of the plot. Anyone knows how to control that coloring ?
> Thanks.
> Guillaume
>

The option you are looking for is ColorFunctionScaling -> False. However,  
since RGBColor expects its arguments to be normalised, you will have to do  
this yourself:

ListPointPlot3D[
  Flatten[Table[Table[{i, j, 0}, {j, -30, 30}], {i, -30, 30}], 1],
  ColorFunction -> Function[{x, y, z}, RGBColor[Abs[x]/30, 0, 0]],
  ColorFunctionScaling -> False
]

ListPointPlot3D[
  Flatten[Table[Table[{i, j, 0}, {j, -30, 30}], {i, -30, 30}], 1],
  ColorFunction ->
   Function[{x, y, z}, RGBColor[(x^2 + y^2)/(2 30^2), 0, 0]],
  ColorFunctionScaling -> False
]

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web