comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » 3D data on a color coded line plot!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
3D data on a color coded line plot! [message #86203] Thu, 17 October 2013 08:17 Go to next message
Steve Daal is currently offline  Steve Daal
Messages: 13
Registered: October 2011
Junior Member
Hi,

I thought this would be an easy thing to do, but seems I am missing or overseeing something!

I have 3D data: density, pressure, and time.
I want to plot time vs density, with the pressure as a color code on the density trace.
Coyote's time vs elevation example doesn't work, since its 2D, and the colors are just over plotted, meaning that the red color would only be at the upper values of time (X axis) or elevation (Y axis).
In my case, the color coded data is independent, so the red could be at any place in the plot.
How to do that?!

Thanks,
S
Re: 3D data on a color coded line plot! [message #86205 is a reply to message #86203] Thu, 17 October 2013 08:42 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
steve.daal@gmail.com writes:

> I thought this would be an easy thing to do, but seems I am missing or
overseeing something!
>
> I have 3D data: density, pressure, and time.
> I want to plot time vs density, with the pressure as a color code on the density trace.
> Coyote's time vs elevation example doesn't work, since its 2D, and the colors are just over plotted, meaning that the red color would only be at the upper values of time (X axis) or elevation (Y axis).
> In my case, the color coded data is independent, so the red could be at any place in the plot.
> How to do that?!

It *is* easy to do. It is just a simple variation of the colored line
plots shown in the Coyote Plot Gallery.

density = cgDemoData(1)
pressure= cgDemoData(17)
time = cgScaleVector(Findgen(N_Elements(density)), 0, 6)
thick = (!D.Name EQ 'PS') ? 6 : 3
cgDisplay
pressureColors = BytScl(pressure)
cgPlot, time, density, /NoData, XTitle='Time', $
YTitle='Density', Label='Colored by Pressure'
FOR j=0,N_Elements(pressure)-2 DO cgPlotS, $
[time[j], time[j+1]], [density[j], density[j+1]], $
Color=pressureColors[j], Thick=thick
FOR j=0,N_Elements(pressure)-1,2 DO cgPlotS, $
time[j], density[j], PSym=2, $
SymSize=1.5, Color=pressureColors[j]
END

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: 3D data on a color coded line plot! [message #86208 is a reply to message #86205] Thu, 17 October 2013 08:51 Go to previous message
Steve Daal is currently offline  Steve Daal
Messages: 13
Registered: October 2011
Junior Member
Indeed it was easy. I screwed up with setting the pressure colors, now I see the light.
Thanks David!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: dialog_message leads to segmentation fault
Next Topic: Interactively crop an image with NG

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:34:52 PDT 2025

Total time taken to generate the page: 0.00432 seconds