I have tried to improve the caxis function, so that a colorbar is updated automatically.
First apply the patch [1] to caxis.m:
and take the following example:
colormap(jet);
contourf(peaks(),-7:8);
colorbar;
If you issue a
caxis([-1 5]);
the plot changes and the colorbar adapts to the new color limits - fine.
But if we write
caxis('auto')
the plot changes as expected but the colorbar does not revert to the original scale. The interesting point is, if you uncomment the pause(0.5) command and try the same command sequence everything works
- the plot changes and the colorbar adapts in any case.
So, my question, any idea what is going on here?
Kai
[1] caxis patch
--- high_level/caxis.m 2007-04-24 20:38:40.000000000 +0000
+++ high_level/caxis.m 2007-04-26 19:44:38.000000000 +0000
@@ -53,4 +53,11 @@
print_usage();
endif
endif
-endfunction
\ Kein Zeilenumbruch am Dateiende.
+ h = findobj(gcf(),'tag','colorbar')
+ if (h)
+ disp('colorbar')
+ %pause(0.5)
+ colorbar;
+ end
+endfunction
+
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
maybe this is because of how octplot (well actually fltk) refreshes the screen.
pause is overloaded and calles
octplot_redraw();
maybe you should try calling octplot_redraw directly.
Shai
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I have tried to improve the caxis function, so that a colorbar is updated automatically.
First apply the patch [1] to caxis.m:
and take the following example:
colormap(jet);
contourf(peaks(),-7:8);
colorbar;
If you issue a
caxis([-1 5]);
the plot changes and the colorbar adapts to the new color limits - fine.
But if we write
caxis('auto')
the plot changes as expected but the colorbar does not revert to the original scale. The interesting point is, if you uncomment the pause(0.5) command and try the same command sequence everything works
- the plot changes and the colorbar adapts in any case.
So, my question, any idea what is going on here?
Kai
[1] caxis patch
--- high_level/caxis.m 2007-04-24 20:38:40.000000000 +0000
+++ high_level/caxis.m 2007-04-26 19:44:38.000000000 +0000
@@ -53,4 +53,11 @@
print_usage();
endif
endif
-endfunction
\ Kein Zeilenumbruch am Dateiende.
+ h = findobj(gcf(),'tag','colorbar')
+ if (h)
+ disp('colorbar')
+ %pause(0.5)
+ colorbar;
+ end
+endfunction
+
maybe this is because of how octplot (well actually fltk) refreshes the screen.
pause is overloaded and calles
octplot_redraw();
maybe you should try calling octplot_redraw directly.
Shai