Changing a 2D color wave from red, green, blue to red, yellow, blue: (0, 65535,0) = Green to --> (0,65535,0)=Yellow

Hej folks,

I have a small cosmitic problem in coloring my data points and hope that somebody has an Idea on how to solve this problem.

In short: Is it possible to change the color pattern in a Three-column color wave from red, green, blue to red, yellow, blue. So that the second column in this wave does not correspond to green anymore but to yellow?


To describe my data in more detail in case there is a way around:

I have sets of (x,y,z) data points ranging form 0<=x<=1, 0<=y<=1 and 0<=z<=1, with the condition that x+y+z=1.

Right now I plot them in a 2D scatter plot with (y vs x). The z coordinates are not important for this as x=0 and y=0 represents z=1 e.g. due to the condition.

For interpretations sake I want to color the data points according to their coordinates in this x,y scatter plot.

To be precise:

For x=1, y=0 ... this data point should be red.
For x=0, y=1 ... this data point should be blue.
For x=0, y=0 ... this data point should be yellow. (corresponding to z=1)

and all intermediate data points should be accordingly mixed.

I found a solution in using a "Three-column color wave". I use my data and scale and arrange them accordingly - and it works nearly perfectly.

The only problem is that I end up with red, green and blue, but I would like to have red, yellow and blue. The reason is the color coding: (65535,0,0) = red; (0,65535,0) = green, (0,0,65535) = blue.

Is it therefore possible to change (0,65535,0) = green to (0,65535,0) = yellow??? Or does anybody has an alternative idea.

I know it is only a small problem, but it would be to cheery on the cake if I would be able to exchange green for yellow.

Many thanks in advance.

Topaz





I think you solution could be something like this:
x=1, y=0: Red=(65535,0,0)
x=0, y=1: Blue=(0,0,65535)
x=0, y=0: Yellow=(65535,65535,0)
x=1, y=1: Magenta=(65535,0,65535)

So you can set your colours using an interpolation according to your x,y data:
colour(x,y)=(R,G,B) where

R=(x+y<1) ? 65535*(1-y) : 65535*x
G=(y>x) ? 65535*(1-y) : 65535*(1-x)
B=65535*y

Hope this helps!
Kurt




Hej Kurt,

thanks for the quick reply, but I don't think this will work. I played around along the line you suggested, but I could not come up with something that would show the right color.

I will try to be a bit more specific with my data. The problem with the interpolation is that I have x,y,and z and x+y+z=1.

The x,y and z values correspond to intensity of fluorecent proteins (GFP variants) that are expressed in cells in relation to each other. x=1 means that the cells are only red. x=0.25, y=0.25, z=0.5 means that the cells are equally strong in red and blue, but that yellow is twice as strong as either of them.

I only need to plot x vs y because it shows the z value indirectly (x=0 and y=0 means z=1). I have a attached some example plots.

I scale my data points (range 0 to 1) to 65535 and put them into the color wave function that has 3 columns with the first corresponding to red, second to green and 3rd to blue.

e.g.

x z y
1 0 0 --> (65535,0,0) --> red
0 1 0 --> (0,65535,0) --> green
0 0 1 --> (0,0,65535) --> blue
0.5 0 0.5 --> (32767,0,32767) --> something between red and blue

The problem with showing yellow is that I have to transform:
x z y
0 1 0 --> (65535,65535,0) --> Yellow

But I still need to keep:
x z y
1 0 0 --> (65535,0,0) --> Red

All the different yellow shades need to have 65535 in the first column.

So I don't see how I can simply adjust the x values.

Every recalculation I did lead to some wrong mixture of red, yellow or blue.


I wondered if there is a different possibility of doing this like linking a " red to yellow" color table to the x values and a "yellow to blue" color table to the y values. So some kind of f(x,y) instead of f(z) for the color scaling a scatterplot.

But, Kurt, thanks for trying to help nonetheless ... I will think about the scaling a bit more.

Have a good evening,

Topaz

test.PNG (49.83 KB)
Hej Kurt,

you were right with the rescaling ... I found a solution now, but it looks a bit different.

R=(1-y)*65535
G=(1-x-y)*65535
B=y*65535

Just wanted to say thanks!

cheers mate,

Topaz