%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 :(