Graphs

Hello,

I have a dataset with date/time as the key value with other linked valies of H2O, dD, d and d18O which vary randomly over time.
I would like to make a graph which is one colour for H2O under a certain value and another colour for H2O over this value in order to show the limit of a previous variable. However since the high and low h2O values are jumbles throughout the dataset I'm not sure how to do this. Basically I'm just looking for a way to say all h2O values>30,000ppm = blue. and all h2O values < 30,000 = red.

Does anyone have any ideas?
the easiest way would be two separate waves with are being displayed with different colors. To split the your H2O way use:

Duplicate/O h2o, red, blue
red = h2o <= 30000 ? h2o : NaN
blue = h2o > 30000 ? h2o : NaN
I think you can do it this using something like:
modifygraph zColorMax=(0,0,65535) // blue
modifygraph zColorMin=(65535,0,0) // red
ModifyGraph zColor(wave0)={wave0,30000,30000,Rainbow,0}

Note: You need to substitute "wave0" for the name of your wave.
I have not thoroughly tested this.

Hope this helps,
Kurt
Thanks heaps for the help! Would I also be able to change the corresponding dD, d and d18O values to blue where H2O is over 30,000? i.e. data taken at the same time as H2O measurements, and where H2O measurements > 30,000 then they also appear blue?
Ah, so in this case I would make a separate colour wave - say wColour - with the same number of points as your data waves, and use it like this:
wColour[]=11*(wave0[p]>30000) // in Rainbow16, red is 0 and blue is 11
ModifyGraph zColor(wave0)={wColour,0,16,Rainbow16,0}

Simply repeat the last line for each of your other waves on the plot.

Regards,
Kurt
This is exactly what I was after, thanks for the help! I just realised however that values over 40,000 may need to be a different colour - is there an easy solution for this?
GeraldJames wrote:
This is exactly what I was after, thanks for the help! I just realised however that values over 40,000 may need to be a different colour - is there an easy solution for this?

Yes - just set the corresponding value in wColour (in the example I gave earlier) to a different value - e.g. 7 for green in Rainbow16.
I'm having a bit of trouble getting all three colours working i.e. 0 - 30000 (red), 30000-40000 (blue) and >40000(green). It's just taking a lot of time and I can't work it out, is there something else I might have to do?
GeraldJames wrote:
I'm having a bit of trouble getting all three colours working i.e. 0 - 30000 (red), 30000-40000 (blue) and >40000(green). It's just taking a lot of time and I can't work it out, is there something else I might have to do?

Try this function, it should illustrate the solution:
Function Test()
    Make/O/N=5 wave0,wave1
    wave0={25000,31000,45000,28000,32000} // the data that determines colour
    wave1={5,4.5,4,3,6} // some other data
    Make/O/N=5 wColour // the wave that indicates colour
    variable i
    for(i = 0 ; i < DimSize(wave0,0) ; i += 1 )
        if(wave0[i] < 30000)
            wColour[i] = 0 // red in Rainbow16
        elseif(wave0[i]  >40000)
            wColour[i] = 7 // green in Rainbow16
        else
            wColour[i] = 11 // blue in Rainbow16
        endif
    endfor
    Display wave0
    AppendToGraph/R wave1
    ModifyGraph mode=3,marker(wave0)=16,marker(wave1)=17 // wave0:squares, wave1:triangles
    ModifyGraph zColor(wave0)={wColour,0,16,Rainbow16,0}
    ModifyGraph zColor(wave1)={wColour,0,16,Rainbow16,0}
End

If you want different colours try different values in wColour.
And, just in case it's helpful, if you select Data->Packages->Color Wave Editor you will get a control panel providing a point-and-click editor for three-column color waves (in fact, it will edit any three contiguous columns in a wave). It's a convenient way to play with the colors.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com