|
Re: Put a 2d plot and an image into a 3D coordinate system [message #77377 is a reply to message #77363] |
Fri, 26 August 2011 05:02   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Jim writes:
> I am trying to make a series of images with IDL for my simulations.
> After exploring the new IDL graphics system and the coyote graphics
> for over 3 hours, I still don't get a good concept of how to do it.
>
> So, here is a sketch of what I am after:
> http://dl.dropbox.com/u/38390926/idl.jpg
>
> In the sketch, the simulation is basically a color-scale image
> of current density in the 2D simulation plane, which moves
> along the z-axis as the simulation goes.
>
> Can anyone help me with this, please? I really appreciate it.
Well, I wouldn't do this with Coyote Graphics, because
you want something 3D. And, as far as I know, it is
impossible to build a new tool in Function Graphics.
So unless one of the already-built tools does this
(I guess there is a slim possibility), then I think
you are hosed there.
So, I would say you have to build this in object
graphics. I would start with something like
Surf_Contour, where your simulation is similar to
the way the contour plot moves in this program.
You will have to automate the movement, but
that's the trivial part of the program. ;-)
http://www.idlcoyote.com/misc/surf_contour.pro
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|
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  |
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
|
|
|