octave-maintainers
[Top][All Lists]
Advanced

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

axis behavior


From: Michael D Godfrey
Subject: axis behavior
Date: Tue, 12 Jun 2012 15:48:11 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0

Using a recent devel build I encountered behavior of axis()
which I did not expect.  The simple example below indicates
part of the problem:
octave:18> close all
octave:19> axis
ans =

   0   1   0   1

octave:20> hold on
octave:21> plot(1:10)
octave:22> axis
ans =

    0   10    0   10

octave:23> ishold
ans =  1
octave:24> plot(1:20)
octave:25> axis
ans =

    0.00000   20.00000    0.06458   20.06458

octave:26> plot(1:15)
octave:27> axis
ans =

    0.00000   20.00000    0.06458   20.06458

octave:28> plot(1:30)
octave:29> axis
ans =

    0.00000   20.00000    0.06458   20.06458

octave:30>
===============================
Initially the axis arguments are expanded to plot all of
the new data (hold on).  But, axis does not shrink if
data that require smaller axes are plotted. Then, however
axis() stops being expanded to fit new data.

In the above example, I had done some other plotting before
the close all.  A new execution of Octave produces:
octave:1> axis
ans =

   0   1   0   1

octave:2> hold on
octave:3> plot(1:10)
octave:4> axis
ans =

    0   10    0   10

octave:5> ishold
ans =  1
octave:6> plot(1:20)
octave:7> axis
ans =

    0   20    0   20

octave:8> plot(1:15)
octave:9> axis
ans =

    0   20    0   20

octave:10> plot(1:30)
octave:11> axis
ans =

    0   30    0   30

octave:12>
====================================
The expected
behavior of the axis vector is not very fully described, as
far as I could find, in the Manual.  help axis, help close, etc.
provide some additional information.  But, what is really
supposed to happen is not clear.  The above behavior is
not obviously what is intended.

Does anyone know, or have an opinion about, what should
really be done with the axis vector?  This should cover both
the hold on and the hold off cases.  If this can be documented
then we can work on making the code match the documentation.

I learned this while discovering that under some circumstances:

plot(x1)
hold on
plot(x2)
print 1.pdf
clear all
hold on
plot(x4)
print 2.pdf
quit
octave
hold on
plot(x4)
print 2a.pdf

produces the result that the BoundingBoxes for 2.pdf and
2a.pdf are not the same. This means that clear all is not clearing
all of the figure state.

I will try to produce a real simple example to show this and
put it in a bug report.  Right now, this behavior is buried in other
code.  But, it means that, to get correct BoundingBoxes it is
necessary to quit Octave and restart when it would be more
convenient to plot the sequence of plots in a loop.

It may be as simple as the fact that clear all does not reset
hold to its default, but I think it is deeper than that.
clear all does reset the axis vector to: 0 1 0 1.
In any case, it would seem that there is an argument for changing
clear all to reset hold.

mdg



reply via email to

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