Menu

caxis issue

Kai Habel
2007-04-26
2013-04-25
  • Kai Habel

    Kai Habel - 2007-04-26

    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
    +

     
    • Shai Ayal

      Shai Ayal - 2007-04-27

      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

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.