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

Home » Public Forums » archive » Re: Put a 2d plot and an image into a 3D coordinate system
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Put a 2d plot and an image into a 3D coordinate system [message #77435 is a reply to message #77381] Tue, 30 August 2011 08:31 Go to previous message
Mark Piper is currently offline  Mark Piper
Messages: 198
Registered: December 2009
Senior Member
On 8/25/2011 11:07 PM, Jim wrote:
> BTW, as a starting point for making this kind of plot, I used the following fake data:
> <code>
> image = dist(200)
> z = findgen(500)
> phi = gaussian(z) ; make a gaussian potential profile as a function of z.

Hi Jim,

I have a NG solution. Though it uses less code than OG, I had to think
about it a bit (NG are still much newer to me than OG). I also had to
rely on the undocumented TEXTUPDIR property to flip the labels on the Z
axis (thanks, CT!). Please give this a try:

n1 = 200
n2 = 500
image = dist(n1)
z = findgen(n2)
phi = gaussian_function(n2/10, width=n2)

w = window()
w.refresh, /disable

; Set up 3D axes and phi plot.
p = plot3d(z*0.0+n1, phi*n1, z, axis_style=2, /current, $
xrange=[0,n1], xtitle='X', ytitle='Y', ztitle='Z')
p.rotate, 30, /zaxis
p.rotate, 90, /xaxis

; Hide obscuring axes.
to_hide = 'axis' + strtrim([3, 4, 6, 7, 8, 9, 10, 11], 2)
foreach axis, to_hide do p[axis].hide = 1

; Make phi axis.
phiaxis = axis('y', location=[max(p.xrange), 0.0, max(p.zrange)], $
textpos=1, title='$\phi$')
phiaxis.tickname = $
string(float(phiaxis.tickname)/n1, format='(f4.2)')

; Display image.
g = image(image, overplot=p, transparency=20)
g.zvalue = 200

; XXX: I got help in uncovering TEXTUPDIR. Should it be exposed?
p['zaxis'].setproperty, textupdir=[0,0,-1], /undoc

w.refresh
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Porting OS X IDL 7.0 to Linux IDL 8.0
Next Topic: Put a 2d plot and an image into a 3D coordinate system

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

Current Time: Sat Oct 11 11:53:38 PDT 2025

Total time taken to generate the page: 0.56025 seconds