octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #65315] Colorbar not saved appropriately with


From: Glenn Groeschel
Subject: [Octave-bug-tracker] [bug #65315] Colorbar not saved appropriately with hgsave
Date: Wed, 14 Feb 2024 12:38:39 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?65315>

                 Summary: Colorbar not saved appropriately with hgsave
                   Group: GNU Octave
               Submitter: glenn
               Submitted: Wed 14 Feb 2024 05:38:39 PM UTC
                Category: Plotting
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 8.4.0
         Discussion Lock: Any
        Operating System: Microsoft Windows
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Wed 14 Feb 2024 05:38:39 PM UTC By: Glenn Groeschel <glenn>
Great software, it is incredible what Octave has grown into.
Three related (I think) bugs to colorbars:
1. When an axis with a 'tag' property is saved using hgsave and it has a
colorbar, the colorbar is not recreated when using hgload.

2. When an axis with a colorbar is saved with hgsave and reopened with hgload,
changes to the colormap and color axis limits are updated on the main axis but
not on the colorbar axis.

3. Any callbacks aren't saved using hgsave

I would expect a figure opened with hgload would be identical to when it was
saved both visually and functionally (including buttondown callbacks).

I think all three issues are related to the hgsave function and how it parses
the existing figure, which I why I grouped the three items together.

I'm using Windows 10, 22H2
Octave v8.4.0,"x86_64-w64-mingw32"

Code reproducing issues below. 

%Minimum working example to demonstrating
% 1. The colorbar is not saved using hgsave if the main axis uses the 'tag'
property
% 2. When opening a saved figure with a colorbar the colorbar is no longer
linked to
%    the main axis when using caxis or colormap functions
% 3. Callbacks aren't saved using hgsave, so when figures are reopened they do
not
%    function the same as the original figure

[x,y,z]=sombrero();
hfig=figure;
hax=axes(hfig);
set(hax,'tag','sombrero');  %Tag to find axis easily later
hsrf=mesh(hax,x,y,z);
hcb=colorbar(hax);
colormap(hax,'jet'); %Both plot and color bar adjust appropriately on new
figure
hgsave(hfig,'color_bar_test.ofig');

%open saved figure
hfig2=hgload('color_bar_test.ofig'); %New figure opens, missing colorbar

%If we do everything the same but don't use tag property colorbar is saved
hfig3=figure;
hax3=axes(hfig3);
%set(hax3,'tag','sombrero');  %Tag to find axis easily later
hsrf3=mesh(hax3,x,y,z);
set(hax3,'buttondownfcn', @(h, e) disp ("Button Down Callback"));
hcb3=colorbar(hax3);
colormap(hax3,'jet'); %Both plot and color bar adjust appropriately on new
figure
caxis(hax3,[-4,4]);  %Axis limits and legend update, :)
%Clicking on the axis of figure3 display 'Button Down Callback'
hgsave(hfig3,'color_bar_test_notag.ofig');

%open saved figure
hfig4=hgload('color_bar_test_notag.ofig'); %New figure opens, with colorbar
%Try to change caxis limits
hax4=findobj(hfig4,'type','axes','xlimmode','auto');  %Color bar has manual
xlimmode, use this to find sombrero axis
colormap(hax4,'winter'); %Colorbar does not update, no longer linked :(
caxis(hax4,[-1,1]); %Axis limits also not linked anymore :(
%Clicking on axis of figure4, no callback is fired or even exists
missing=get(hax4,'buttondownfcn');  %Callback is empty, not saved :(








    _______________________________________________________
File Attachments:

Octave file demonstrating perceived bugs

-------------------------------------------------------
Name: color_bar_test.m  Size: 2KiB
<http://savannah.gnu.org/bugs/download.php?file_id=55701>

    AGPL NOTICE

These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://git.savannah.nongnu.org/cgit/administration/savane.git/snapshot/savane-8523ddde37d79b56404205a28f13efda563b0104.tar.gz

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65315>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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