# "axis scale / dataspectratio" - problem with 3D-graph

17 messages
Open this post in threaded view
|

## "axis scale / dataspectratio" - problem with 3D-graph

 Hello, I've got an ellipsoid, x and y with same dimensions (xr = yr =6800), and want to show only one half of it. When I set the y-limits so that only one half is shown (ylim([0 6800]), the graph is stretched, so that it looks like half of an egg. I've tried to set the dataspectratio to [1 1 1] but then the graph is only shown in right dimensions when I look from the front( like 2D). For Matlab I've found the "axis vis3d" function which allows to rotate a 3D-graph showing the right dimensons from all directions, but I can't find something like that for Octave. (mathworks.com: "axis vis3d freezes aspect ratio properties to enable rotation of 3-D objects and overrides stretch-to-fill.") I'm using a portable version : Octave 3.0.0 whith QtOctave 0.7.2 I would be very very thankful if someone has a solution for that, because I've been trying to solve it by myself for many many frustrating hours. Greetings! Clara _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave 3d.jpg (84K) Download Attachment
Open this post in threaded view
|

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

 2011/5/3 Clara Brück <[hidden email]>: > For Matlab I've found the "axis vis3d" function which allows to > rotate a 3D-graph showing the right dimensons from all directions, > but I can't find something like that for Octave. If you try axis([xlo,xhi,ylo,yhi,zlo,zli],"square"), do you get what you want? > I'm using a portable version : Octave 3.0.0 whith QtOctave 0.7.2 This is a very old Octave version. Are you unable to get a newer version? I'm almost sure the solution I proposed above won't work on an older version. HTH, - Jordi G. H. _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

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

 > For Matlab I've found the "axis vis3d" function which allows to > rotate a 3D-graph showing the right dimensons from all directions, > but I can't find something like that for Octave. Hello, Clara I wrote something in the online wiki about this. Have a look at the section headed "Adjusting axes on three-dimensional plots" on the following page to see if it addresses your problem. http://wiki.octave.org/wiki.pl?Producing_Graphical_OutputYou might need to experiment with the vector (denoted [a b c d]) in the set(gca(), 'position', [ a b c d]) command - I'm afraid I can't remember whether there was some reason for the numbers I used or whether I found them by trial and error. Best wishes However good you think Octave is, it's much, much better.
Open this post in threaded view
|

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

Open this post in threaded view
|

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

 2011/5/4 Clara Brück <[hidden email]>: > >>2011/5/3 Jordi Gutiérrez Hermoso [hidden email] >> >>> I'm using a portable version : Octave 3.0.0 whith QtOctave 0.7.2 >> >> This is a very old Octave version. Are you unable to get a newer >> version? I'm almost sure the solution I proposed above won't work on >> an older version. > > I need a portable version, Excuse my ignorance, but what is a portable version of Octave? Where did you find this very old 3.0.0 version? The graphics support was very beta back then, but it's gotten better. Can we help you get a newer version? >> If you try axis([xlo,xhi,ylo,yhi,zlo,zli],"square"), do you get what >> you want? > > Tried this: > > octave:5> axis([-8000,8000,0,8000,-8000,8000],"square") > > but the result is exactly the same (2D okay, 3D->"1/2egg") :( > But I'dont want it to be a squere anyway. Square doesn't mean that all axes will be the same length. It means the projection deformation along each axis will be the same. I'm almost sure this is what you want. Can you show me the full code for making your ellipsoid? I can take a screenshot with Octave 3.4 and square projection and show it to you. If it's what you want, maybe we can work on getting a version of Octave 3.4 that you can easily share with your students. - Jordi G. H. _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

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

 On 4 May 2011, at 14:29, Jordi Gutiérrez Hermoso wrote: > Square doesn't mean that all axes will be the same length. It means > the projection deformation along each axis will be the same. I'm > almost sure this is what you want. I might be mistaken, but isn't that done with the option "equal" rather than "square"? c. _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

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

 In reply to this post by C.B. Tried this also: octave:17> axis([-8000,8000,0,8000,-8000,8000],"square") octave:18> hold("on") octave:19> plot3 ([0 8000]', [0 8000]', [0 8000]', "r") octave:20> set (gca (), "position", [0.13000 -0.05000 0.77500 1.08000]); This works on my Octave version 3.2.3 (just tried it) May I just check that you noticed that your axes do not have a cubic ratio. Did you mean to write axis([-8000,8000,-8000,8000,-8000,8000],"square")? With regard to your other question >Is there a possibility to make the ellipsoid transparent, so that these 3 Lines are visible? the command that you need is hidden() This may be used as above; under these circumstances, it will toggle between 'off' and 'on', or you could specify explicitly eg hidden('off') Hope this works. _______________________________________________ Help-octave mailing list [hidden email]https://mailman.cae.wisc.edu/listinfo/help-octave However good you think Octave is, it's much, much better.
Open this post in threaded view
|

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

 > hidden off I apologise - I did not notice that Jordi had already answered this. However, there is a refinement. I have just experimented with plotting a plane in plot3() and a cube that intersects with the plane. I found that the order of plotting is important. The following appears to work: Plot the plane (or your spheroid), then octave:>hidden off then plot the other structure For some reason, plotting the structure before specifying hidden off makes the plane transparent for the axes but not for the object. Hope this might work. However good you think Octave is, it's much, much better.
Open this post in threaded view
|

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

Open this post in threaded view
|

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

 This was the output ... However good you think Octave is, it's much, much better.
Open this post in threaded view
|

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

 This is without hidden off to show that the bugs do not appear under these circumstances However good you think Octave is, it's much, much better.
Open this post in threaded view
|

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

 Hi! That's perfect! Many Many Thanks!! Thats my Code and it works :) clf; xc=0 yc=0 zc=0 xr=yr= 7000 zr=5000 n = 20 axis([-8000 8000 -8000 8000 -8000 8000], 'square'); hold on; [x,y,z] = ellipsoid(xc,yc,zc,xr,yr,zr,n); mesh(x-8000, y, z); #hidden off; set (gca (), "position", [0.13000 -0.05000 0.77500 1.08000]); plot3 ([-8000 -8000], [0 0], [-8000 8000], "color", "r", 'linewidth', 2); plot3 ([-8000 -8000], [-8000 8000], [0 0], "color", "r", 'linewidth', 2); plot3 ([-8000 8000], [0 0], [0 0], "color","r", 'linewidth', 2); box off; #axis off; I've got the problems with the wrong lines with hidden off, too. But the lines are visible from the front.  I think that should do it. Greetings! Clara
Open this post in threaded view
|

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

 Hi, Clara I have submitted a bug report (#33239 at http://savannah.gnu.org/bugs/?group=octave). I see Jordi has already confirmed it ! I am sure you would know yourself, but would it suit your purpose better to plot the ellipsoid centred on the origin, with the scale on the axis that is orthogonal to the bisection specified as 0 to 16000? David However good you think Octave is, it's much, much better.
Open this post in threaded view
|

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

 In reply to this post by C.Brueck Clara Thank you for drawing my attention to the "ellipsoid" function. It's fun! I have experimented with it a little. As you will probably have noted yourself, your code (as it stands, plotting the centre so that it is at x=-8000) might be rationalised slightly by setting: xc = -8000 (rather than 0) during the declarations and calling mesh(x, y, z) However good you think Octave is, it's much, much better.
Open this post in threaded view
|

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

 Jordi Do you know whether there is a particular reason why the "offset" for the mesh plot does not reflect the mathematical logic behind passing parameters to a function to specify a translation? As you will know eg: f(x-k) translates f(x) in the positive direction along the x axis. Whereas (unless I have made a silly mistake that will come back to embarrass me!), this conflicts with the notation for the mesh function eg: mesh(x-k, y, z) translates the (3d) plot in the negative direction (in this particular case along the x axis also). However good you think Octave is, it's much, much better.