axis equal help!

View: New views
7 Messages — Rating Filter:   Alert me  

axis equal help!

by pvfloripa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Everybody,

I am trying to plot a 3-D plot from several points. However, when I use the "axis equal" command, only the X and Y axis are set to the same scale, whereas Z doesn't change, making the plot look wrong. Is there any way around this?

The same code works fine in Matlab.

Many thanks!

Paulo

Re: axis equal help!

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Aug 5, 2009, at 7:40 PM, pvfloripa wrote:

> Hi Everybody,
>
> I am trying to plot a 3-D plot from several points. However, when I  
> use the
> "axis equal" command, only the X and Y axis are set to the same scale,
> whereas Z doesn't change, making the plot look wrong. Is there any way
> around this?
>
> The same code works fine in Matlab.
>
> Many thanks!
>
> Paulo

Something like the following should work ...

figure (1)
clf
surf (peaks)
axis auto
xl = get (gca, "xlim");
yl = get (gca, "ylim");
zl = get (gca, "zlim");
span = max ([diff(xl), diff(yl), diff(zl)]);
xlim (mean (xl) + span*[-0.5, 0.5])
ylim (mean (yl) + span*[-0.5, 0.5])
zlim (mean (zl) + span*[-0.5, 0.5])

Ben

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: axis equal help!

by John W. Eaton-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On  5-Aug-2009, Ben Abbott wrote:

| On Aug 5, 2009, at 7:40 PM, pvfloripa wrote:
|
| > Hi Everybody,
| >
| > I am trying to plot a 3-D plot from several points. However, when I  
| > use the
| > "axis equal" command, only the X and Y axis are set to the same scale,
| > whereas Z doesn't change, making the plot look wrong. Is there any way
| > around this?
| >
| > The same code works fine in Matlab.
| >
| > Many thanks!
| >
| > Paulo
|
| Something like the following should work ...
|
| figure (1)
| clf
| surf (peaks)
| axis auto
| xl = get (gca, "xlim");
| yl = get (gca, "ylim");
| zl = get (gca, "zlim");
| span = max ([diff(xl), diff(yl), diff(zl)]);
| xlim (mean (xl) + span*[-0.5, 0.5])
| ylim (mean (yl) + span*[-0.5, 0.5])
| zlim (mean (zl) + span*[-0.5, 0.5])

Does 3d plotting in gnuplot have a way to specify equal axes?  The
docs for the version I have (4.2.5) say that "set size ratio" has no
effect for 3d plots, and that's what we are currently using to get
equal axes.

jwe
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: axis equal help!

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Aug 5, 2009, at 8:28 PM, John W. Eaton wrote:

> On  5-Aug-2009, Ben Abbott wrote:
>
> | On Aug 5, 2009, at 7:40 PM, pvfloripa wrote:
> |
> | > Hi Everybody,
> | >
> | > I am trying to plot a 3-D plot from several points. However,  
> when I
> | > use the
> | > "axis equal" command, only the X and Y axis are set to the same  
> scale,
> | > whereas Z doesn't change, making the plot look wrong. Is there  
> any way
> | > around this?
> | >
> | > The same code works fine in Matlab.
> | >
> | > Many thanks!
> | >
> | > Paulo
> |
> | Something like the following should work ...
> |
> | figure (1)
> | clf
> | surf (peaks)
> | axis auto
> | xl = get (gca, "xlim");
> | yl = get (gca, "ylim");
> | zl = get (gca, "zlim");
> | span = max ([diff(xl), diff(yl), diff(zl)]);
> | xlim (mean (xl) + span*[-0.5, 0.5])
> | ylim (mean (yl) + span*[-0.5, 0.5])
> | zlim (mean (zl) + span*[-0.5, 0.5])
>
> Does 3d plotting in gnuplot have a way to specify equal axes?  The
> docs for the version I have (4.2.5) say that "set size ratio" has no
> effect for 3d plots, and that's what we are currently using to get
> equal axes.
>
> jwe

I think there is a simple fix for gnuplot >4.3 (using the approach I  
outlined above). I haven't looked into the older gnuplot yet.

However, I noticed that demo("axis",6) produces an error.

I don't have the time to dig into that right now.

Ben

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: axis equal help!

by John W. Eaton-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On  5-Aug-2009, Ben Abbott wrote:

| I think there is a simple fix for gnuplot >4.3 (using the approach I  
| outlined above). I haven't looked into the older gnuplot yet.
|
| However, I noticed that demo("axis",6) produces an error.

I don't see an error message and the plot it generates looks OK to
me (but maybe it is wrong and I don't understand how the plot is
intended to appear).  What is the problem you see?

jwe
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: axis equal help!

by pvfloripa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

Thanks for all your replies.
The problem I see is that, say I have 3 line segments that form the sketch of a door, defined by 6 points:

point1 = [ 0 0 0]
point2 = [ 0 0 2]

point3 = [ 0 0 2]
point4 = [ 1 0 2]

point5 = [ 1 0 2]
point6 = [ 1 0 0]

which correspond to the sides (points 1,2 and 5,6) and the top ( points 3,4) of the door.
Instead of seeing the door in the correct proportion (ie, the height 2x the width), I see a very tall and very thin door.

I will try the solutions suggested and let you know.

Thanks again,

Paulo



John W. Eaton-3 wrote:
On  5-Aug-2009, Ben Abbott wrote:

| I think there is a simple fix for gnuplot >4.3 (using the approach I  
| outlined above). I haven't looked into the older gnuplot yet.
|
| However, I noticed that demo("axis",6) produces an error.

I don't see an error message and the plot it generates looks OK to
me (but maybe it is wrong and I don't understand how the plot is
intended to appear).  What is the problem you see?

jwe
_______________________________________________
Help-octave mailing list
Help-octave@octave.org
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: axis equal help!

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Aug 5, 2009, at 10:26 PM, John W. Eaton wrote:

> On  5-Aug-2009, Ben Abbott wrote:
>
> | I think there is a simple fix for gnuplot >4.3 (using the approach I
> | outlined above). I haven't looked into the older gnuplot yet.
> |
> | However, I noticed that demo("axis",6) produces an error.
>
> I don't see an error message and the plot it generates looks OK to
> me (but maybe it is wrong and I don't understand how the plot is
> intended to appear).  What is the problem you see?
>
> jwe

You are correct. I deleted my axis.m and pulled a fresh copy, and the  
error is gone.

Ben

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave