Problem with Ben's change to preserve axis propers when used with colorbars

Ben Abbott bpabbott at mac.com
Thu Oct 16 06:49:32 CDT 2008


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




More information about the Octave-maintainers mailing list