help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "axis scale / dataspectratio" - problem with 3D-graph


From: pathematica
Subject: Re: "axis scale / dataspectratio" - problem with 3D-graph
Date: Wed, 4 May 2011 15:00:57 -0700 (PDT)

Clara

I have just noticed that you intentionally made your axes asymmetric,
presumably so that the spheroid was cut in half. The set(gca() ...) command
is forcing the plot to a cubic aspect, so that one of your axes is
stretched. I tried to experiment with the parameters passed to see if this
might be ameliorated but I did not succeed.

Does the following do what you wanted (it actually highlights some bugs,
which you might note)

octave:1> clf;
octave:2> axis([-(1+3*eps) 1 -1 1 -1 1], 'square');
octave:3> hold on;
octave:4> [x,y,z] = sphere;
octave:5> mesh(x-1, y, z);
octave:6> hidden off;
octave:7> set (gca (), "position", [0.13000 -0.05000 0.77500 1.08000]);
octave:8> plot3 ([-1 -1], [0 0], [-1 1], "r", 'linewidth', 2);
octave:9> plot3 ([-1 -1], [-1 1], [0 0], "r", 'linewidth', 2);
octave:10> plot3 ([-1 1], [0 0], [0 0], "r", 'linewidth', 2);
octave:11> box off;
octave:12> axis off;

Notes
1) I cleared the figure.
2) I made the axes symmetrical, from -1 to 1 along each axis.
I added 3*eps for a particular reason (eps denotes the smallest number in
Octave's float representation) - see step 6.
3) I set hold on so that the axes would not be altered by subsequent plots.
4) I loaded the values for a unit sphere (I see you had a sphere of radius
8000 - I could not see how to do that but presumably you know!).
5) I plotted the sphere as a mesh rather than as a surface. I placed it with
its centre at (-1, 0, 0) so that it would be bisected at the yz plane
through x = -1. 
6) I set hidden off at this point so that the axes would be visible (to be
plotted). This appears to highlight some bugs - there are some stray lines
on my plot at various points, including from the "south pole" off in the
positive x direction and some stray mesh lines in the negative x direction
on one side of the sphere. I found that the great circle through in the yz
plane at x=-1 did not plot fully with the x axis specified as -1 to 1, which
is why I added a small number (arbitrary 3 times the smallest float number -
perhaps the smallest float would have worked just as well).
7) This step forces a cubic aspect ratio. As I have made the magnitude of
each axis the same, the hemisphere assumes the correct spherical symmetry.
8, 9 and 10) This plots coordinate axes by hand. I made them red and with a
linewidth of 2 to emphasise them.
11 and 12) I turned off the box and the axes, so that the red axes that I
had created were left as the only coordinate axes. 

As noted, whilst this might be what you intended (I leave you to scale the
axes and the sphere to the size that you want) it features a few bugs in the
mesh plot with hidden off.

Best wishes


--
View this message in context: 
http://octave.1599824.n4.nabble.com/axis-scale-dataspectratio-problem-with-3D-graph-tp3491951p3496904.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]