rafdedier@gmail.com writes:
>
> Hi!
>
> I am having a problem with the axis scaling and position using the AXIS and PLOTS procedure for plotting data in three dimensions.
>
> I have written a test program that demonstrates the problem that is occurring:
>
> PRO TESTPLOT3D
>
> ; Create the random data.
>
> xdata = [0,2,2,0,0,2,2,0,2,0]
> ydata = [0,0,1,1,0,0,1,1,0.5,0.5]
> zdata = [0,0,0,0,2,2,2,2,3,3]
>
> xrange = [0, 3]
> yrange = [0, 1]
> zrange = [0, 3]
> anglex = 30
> anglez = 30
>
> WINDOW, XSIZE = 800, YSIZE = 800
>
> ; Set up the transformation matrix
>
> scale3, xrange = xrange, yrange = yrange, zrange = zrange, $
> ax = anglex, az = anglez
>
> ; Plot the data using plots
> plots, xdata, ydata, zdata, /t3d, psym = 6, color = 255, symsize = 5
>
> axis, xax = 0, /t3d, /data, xrange = xrange, CHARSIZE = 4, xtitle = 'X'
> axis, yax = 0, /t3d, /data, yrange = yrange, CHARSIZE = 4, ytitle = 'Y'
> axis, zax = 2, /t3d, /data, zrange = zrange, CHARSIZE = 4, ztitle = 'Z'
>
>
> END
>
> The file creates a set of x,y,z-datapoints and plots them in three dimensions using the SCALE3- and PLOTS-procedures. I want to add axes (using AXIS) onto the plot, but for some reason, the scaling and the position of the axes is incorrect for the x- and y-axis (and not for the z-axis), as the axes do not fully surround the datapoints. Some datapoints lie outside the axes??
>
>
> Can you see them problem that is occurring?
I see the axes all piled up in a heap at the very bottom
of window, with the data points scattered everywhere. I
have to admit, I don't immediately understand why.
I also have to admit I've never used Scale3 for this
purpose. I would have set the axes up and drawn the data
like this:
; Set the axes up.
surface, dist(20), xrange=xrange, yrange=yrange, zrange=zrange, $
charsize=4, xtitle='X', ytitle='Y', ztitle='Z', /NoData, /Save, $
ax=anglex, az=anglez
; Plot the data using plots
plots, xdata, ydata, zdata, /t3d, psym = 6, color = 255, symsize = 5
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.")
|