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

Home » Public Forums » archive » Re: 3D graphing
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
Re: 3D graphing [message #61981] Mon, 18 August 2008 14:54 Go to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
orangelubee wrote:
> Hello all,
> I've been trying to make a very simple 3D graph for days now and I'm
> completely stumped because I know nothing about this. My data is
> gridded data of temperatures at different levels of the atmosphere
> over Antarctica and I have nice plots using map_set and contour for
> each level separately but I would really like to have a 3D version of
> just one temperature contour throughout the entire atmosphere. Is
> there a way to get a z-axis added to a map and contour at each level?
> I've tried using T3D but I'm not understanding how it applies to
> contour and plot or really how it works at all. I've also tried to
> use the isosurface, scale3 and then polyshade to view a certain
> temperature surface but I keep running into this error: POLYSHADE:
> Vertex 0: X,Y,Z location out of range. which I dont know how to fix.
>
> Is there an easy way to do this or am I way off track?

I think you're heading in the right direction. I wrote a 3d-plotter many years ago to plot
radiosondes ascents in 3-d (I think I may have nicked a copious amount of the code from
one of David Fanning's programs). I can only offer tips towards a direct graphics solution.


Anyway, looking at the code I have, I see stuff like this:

; -----------------------------------------------------
; Use SURFACE to establish the 3D transform and draw
; the base X, Y, and Z axes.
; The IDL documentation was very unclear on how to draw
; axes (i.e. where to get the co-ordinate points from)
; if T3D and SCALE3 are used. So, this method will be
; oh-so-slow for very large n.
; -----------------------------------------------------

SURFACE, FLTARR( n, n ), x, y, $
AZ = 50, $
/NODATA, $
/SAVE

; --------------------------------------------
; Draw the "*" axes as shown below:
;
; ***********
; ** *
; * * *
; o * *
; o * *
; Z o **********o
; o * o
; o* o X
; ooooooooooo
; Y
;
; The axes designated with a "o" are drawn by
; the initial call to SURFACE. All others, the
; "*" axes, are drawn via the AXIS commands
; that follow.
; --------------------------------------------

; -- Dummy axes name
name = REPLICATE( ' ', 30 )

; -- Draw the various axes with default ticklength and no names
AXIS, xmax, ymin, zmin, $
/YAXIS, /T3D, $
YLOG = ylog, $
YTICKNAME = name, YTICKLEN = 0
AXIS, xmax, ymin, zmin, $
/ZAXIS, /T3D, $
ZLOG = zlog, $
ZTICKNAME = name, ZTICKLEN = 0
AXIS, xmin, ymax, zmin, $
/XAXIS, /T3D, $
XLOG = xlog, $
XTICKNAME = name, XTICKLEN = 0
AXIS, xmin, ymax, zmax, $
/XAXIS, /T3D, $
XLOG = xlog, $
XTICKNAME = name, XTICKLEN = 0
AXIS, xmax, ymax, zmin, $
/ZAXIS, /T3D, $
ZLOG = zlog, $
ZTICKNAME = name, ZTICKLEN = 0
AXIS, xmax, ymin, zmax, $
/YAXIS, /T3D, $
YLOG = ylog, $
YTICKNAME = name, YTICKLEN = 0

; ------------------------------
; Enable use of the 3D transform
; ------------------------------

!P.T3D = 1


; --------------------
; Plot the actual data
; --------------------

PLOTS, x, y, z, /T3D

; --------------------
; Plot the projections
; --------------------

; XY projection
IF ( xyproject EQ 1 ) THEN $
PLOTS, x, y, FLTARR( n ) + zmin, $
/T3D, $
THICK = thick, COLOR = project_color, LINESTYLE = linestyle

.etc....

; ---------------------------
; Turn off 3D transformations
; ---------------------------

!P.T3D = 0




I think the important thing is how you establish the 3D transform. I used an "empty"
surface plot. Getting the contour plot on there as well is not something I know how to do
0off the top of my head, but I think there may be a how-to on that in the IDL docs.

Or on David's website (I would check that first). Struan Grey (Gray?) used to have a
website dedicated to all these sorts of shenanigans. Maybe it's still out there?

Good luck.

cheers,

paulv
Re: 3D graphing [message #61982 is a reply to message #61981] Mon, 18 August 2008 14:40 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
orangelubee writes:

> I've been trying to make a very simple 3D graph for days now and I'm
> completely stumped because I know nothing about this. My data is
> gridded data of temperatures at different levels of the atmosphere
> over Antarctica and I have nice plots using map_set and contour for
> each level separately but I would really like to have a 3D version of
> just one temperature contour throughout the entire atmosphere. Is
> there a way to get a z-axis added to a map and contour at each level?
> I've tried using T3D but I'm not understanding how it applies to
> contour and plot or really how it works at all. I've also tried to
> use the isosurface, scale3 and then polyshade to view a certain
> temperature surface but I keep running into this error: POLYSHADE:
> Vertex 0: X,Y,Z location out of range. which I dont know how to fix.
>
> Is there an easy way to do this or am I way off track?

There is no easy way to do this. And you are probably
slightly off track. :-)

Here is an article that describes how to set up a 3D
coordinate system, and use it with a map. PLOT and
CONTOUR can be drawn in this 3D system by setting the
T3D keyword.

http://www.dfanning.com/tips/scatter3d.html

Direct graphics is probably the *worst* way to do this,
but object graphics is even harder. *Far* harder. But is
the only way to get professional looking results, I would
guess.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: 3D graphing [message #62067 is a reply to message #61981] Tue, 19 August 2008 10:48 Go to previous message
orangelubee is currently offline  orangelubee
Messages: 2
Registered: August 2008
Junior Member
Thanks for the help. I hope this doesn't show how computer illiterate
I am (I'm a novice IDLer) but I don't know what the difference between
direct graphics and object graphics. Or what I'm attempting to do in
relation to this, I guess.

I'm going to try both ideas and see how it goes.

Thanks again,
Stephanie
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Transformation of Objects and Models
Next Topic: question on destroying objarr's

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

Current Time: Wed Oct 08 18:56:27 PDT 2025

Total time taken to generate the page: 0.00734 seconds