|
From: Ethan M. <merritt@u.washington.edu> - 2005-08-16 18:15:45
|
On Tuesday 16 August 2005 10:46 am, Robert Hart wrote:
> On Tue, 2005-08-16 at 10:06 -0700, Ethan Merritt wrote:
> > On Tuesday 16 August 2005 09:58 am, Robert Hart wrote:
> > > On Tue, 2005-08-16 at 09:26 -0700, Ethan Merritt wrote:
> > >
> > > > That works, or would if you put parens around the expression:
> > > > set pm3d
> > > > splot "data" using 1:2:3:(rgb($1,$2,$3)) with lines
> > > >
> > >
> > > Are you sure? This just gives: undefined function rgb.
> >
> > I assumed that "rgb" was a user-defined function that assigned
> > an rgb color on the basis of 3D coords x, y, and z.
>
> Maybe I'm missing something really obvious here? I don't understand what
> you mean by "assigned an rgb color". How could I make a function return
> an rgb colour?
One way is to define a palette that maps [0:1] onto the "hue" parameter
of a color wheel. See the demo "colorwheel.dem".
> I want to plot my data such that the colour of each point is defined by:
> r=x
> g=y
> b=z
>
> Now as I understand it, rgb(some colour specifier) is the gnuplot way of
> specifying an arbitrary colour as in:
>
> plot sin(x) lc rgb("salmon")
No, there is no such function currently.
Instead there is a keyword "rgb" that controls the parsing of the
next token on the line.
I'd have to think about whether there is a straight-forward way
to implement the notion "rgb triplet generated by function and
then assigned to linecolor". It may be possible, but I don't
off the top of my head see how it would fit into the current
scheme. Which is to say, it may be a nightmare to implement
even if it's a good idea from the perspective of user interface.
> Specifically what I'm trying to do is visualise the gamut of colours
> used in an image file, such as a photo. I used Imagemagick to quantise
> the number of discrete colours down to a more manageable level, and then
> for each unique colour count how many pixels are of each colour.
>
> I then want to visualise this in 3D by plotting a point at
> (x,y,z)=(r,g,b) with pointsize log(count) and colour (r,g,b)=(r,g,b)
>
> err... I'm not sure how else to explain.
If you have a specific set of discrete colors, then I think what you
need to do for perfect accuracty is to define a discrete palette that
consists of exactly these colors. Let's say you discretize to 128
colors, and define a palette of size 128. Then you can specify your
point colors by choosing directly from this palette:
rgb(x,y,z) = some-function-that-generates-the-palette-index
plot <foo> using 1:2:3:(rgb($1,$2,$3)) lt palette
I don't claim that this is particularly convenient, but it may be
the best you can do using the current code.
--
Ethan A Merritt merritt@u.washington.edu
Biomolecular Structure Center
Mailstop 357742
University of Washington, Seattle, WA 98195
|