# Pseudo colour plots

Hey all,

Given a three dimensional array (table dat), with the first two columns being x,y coordinates of a series of points, and the third being say temperature, is it possible to plot the (x,y) points and colour them according to increasing temperature, and then have touch interpolate the colours between them. Hopefully the end result would be of a similar nature to the attached picture.

Yes there are a couple of ways to do that. One method (not the most effecient) would be to use datto chops/chopto dats to get each horizontal line of color data from the table dat and then merge (composite) each line into a series of vertical lines. For a large image this method would not be very practical.

The second method would be to use a GLSL top and sample a datto chop of the table in as a uniform array or texture buffer. There are some uniform array/texture buffer examples in the wiki on the GLSL top page: derivative.ca/wiki077/index. … e=GLSL_TOP

cheers
Keith

HI Rhys,

and how many distictions of colour are you planning to have?
will it be linear of non-linear?

I think the first method Keith suggests would work for your project unless you are planning to animate it with a changing data set.

it might be useful to make a ramp of the colours you want, then index it from your array to tell the pixel what it needs to be. that way, you could have more general regions of colour that mean different things and can make more sense where there’s a lot going on in a small area but larger areas where not much is happening. That would be best for where you want to have a key to each colour etc.

rod.

Thanks for the replies, I’ll be more clear,

The array will have around 2000 x coordinates, unevenly spaced so non-linear. For each x point there will be 10-30 corresponding y points, again unevenly spaced. So this gives us 2000*30 points, each one with a corresponding temperature. My plan was to normalize the temperature, then multiply it by 240 and use this as a hue value, so the colors will range from red to blue.

Given the non-linear spacing of the points, and the size of the data set, does this rule out keiths initial suggestion?

Cheers, Rhys.

HI Rhys,

I think the first method keith suggested should be still ok because you are not animating this in real time (are you?), so the extra cooking should not be a big problem.

rod

I think it should be fine also if it’s not animated. But because the points aren’t evenly spaced this is what I think you would need to do:

• make a dat table for all the x coordinates for each of the y coordinates for example: make table that is 2 columns wide by the number of rows that you have x coordinates for that particular y coordinate - 1 column for the x coordinate value and the other for the temperature - then do that for each of the y coordinates
• use datto chops to convert each table to multiasample chops with each samples index being the x coordinate and each temperature being the the value of the sample.
• use stretch chops to stretch the number of samples of each the datto chops to the length of the highest x coordinate ei 2000 (btw all the rows of the original tables x coordinates must be in incremental order - you can use a reorder dat if needed) also you need to do this in order interpolate the value of coordinates that don’t have a value in the dat table
• use chopto TOPs for each the stretched chops
• composite all the TOPs : - use over tops with bottom layer of the first over TOP being
a constant TOP of the full final dimensions of the image
- set the extend overlay parameter to “native resolution”
- set translate to operate as pixels
- offset the y coordinate to position each row in its proper place

hope this helps

cheers
Keith

Hey keith, thanks for that in-depth reply!

I’ve began to attempt it (with just a small number of data points), and attached the result:
I split the data up, into tables corresponding to a single height value. Then, I plugged each of these into a single Dat to chop. These chops then had several channels. Is that what you meant by multi-sampling? Next, each chop was stretched to 0.3, since that was my highest x value. Finally I connected each stretch to a Chop to Top.

I’m a bit confused by using the over tops.
Do you mean I should connect each Chop to Top to a separate over top, whose second input is a constant?
Also, how does one set the dimensions of a constant?
finally, the extend overlay parameter of the Over Top doesn’t seem to have a native resolution option. The pre-fit overlay does though, is this the one that should be changed?
colour image.1.toe (4.74 KB)

Hi Rhys your getting closer I don’t have much time tonight or tomorrow to look at your project to deeply but to answer a couple of your questions.

• multisample channel would mean a single channel with multiple samples so you need to set the datto chops to single channel
• yes pre-fit overlay is the correct paramater
• only the first over should have a constant connected then the second input of each next over top will have the previous over top connected to it.

there is a little more trickery involved to get your setup to work I can’t go into all the details now. To start with though all your x and y coordinates should be scaled into integers, and you’ll need to make rows (and columns) with no data for areas where you don’t have any data.
I’ve attached an edited version for you to check out it’s not totally accurate but it might help to get you started. Also I think for a lot of rows and columns you’ll need to use some scripting to make up all the columns and rows with no data.
VideoTest.toe (5.65 KB)