octave-maintainers
[Top][All Lists]
Advanced

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

Re: Problem with Ben's change to preserve axis propers when used with co


From: David Bateman
Subject: Re: Problem with Ben's change to preserve axis propers when used with colorbars
Date: Thu, 16 Oct 2008 13:20:01 +0100
User-agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724)

Ben Abbott wrote:

On Oct 16, 2008, at 6:27 AM, David Bateman wrote:

There is an issue with the changeset

http://hg.savannah.gnu.org/hgweb/octave/rev/4e05ba66ead2

in that the Position and OuterPosition properties are preserved in newplot.. The problem can be seen with

pcolor(peaks())
colorbar()
pause(1)
plot(1:10)

The final plot has an allowance made for the colorbar that has already been deleted.. What is happening is that when a new axis is created, the Position and OuterPosition properties are being stored prior to the old axis being deleted, and it is at the point the old axis is deleted that the callback colorbar:reset_axis is called that removes the allowance for the colorbar in the Position property...

Why do the Position and OuterPosition properties need to be preserved? If there is no particular reason to preserve them, then I'd suggest the patch

I preserved them because that is what Matlab does.

In Matlab, try

>> x = 1:10;
>> plot (x)
>> set (gca, 'Position', [0.2 0.2 0.5 0.5])
>> plot (x)
>> get (gca, 'Position')

However, if the axes is really being deleted, then they should not be preserved. Since looking a cla() I was concerned that the manner in which Octave handled such things was different that what is done by Matlab ... and looking again, it appears that "Units" may need to be added to the list of properties to be preserved.

>> help cla

 CLA Clear current axis.
    CLA deletes all children of the current axes with visible handles.

    CLA RESET deletes all objects (including ones with hidden handles)
    and also resets all axes properties, except Position and Units, to
    their default values.

    CLA(AX) or CLA(AX,'RESET') clears the single axes with handle AX.

Checking ...

>> set(gca,'units','points')
>> plot(1:10)
>> get(gca,'units')
ans =
points

I'm not yet familiar enough with this code to see a how these apparent conflicts should be resolved.

Ben



Ok, then the proper place to do this is in

graphics.cc (void axes::properties::set_defaults (base_graphics_object&, const std::string&))

and in fact there is already a comment there to that effect. I.E.

 // FIXME -- this is not quite right; we should preserve
 // "position" and "units".

I'll take a look and see if I can create a fix that preserves the axes properties, but after the deletion callbacks are run.

D.


--
David Bateman                                address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob) 91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax) The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary



reply via email to

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