Menu

#115 Bugs in 0.4.0 about ""

open
nobody
None
5
2007-07-27
2007-07-27
Anonymous
No

Two Bugs in octplot 0.4.0 (these errors were not in version 0.3.9)

1. "colorbar" only appears in the first subplot, even when you try to add a colorbar to the second subplot

2. "caxis" has the error "max_recursion_limit exceeded"

error: max_recursion_limit exceeded
error: evaluating assignment expression near line 61, column 15
error: evaluating if command near line 60, column 9
error: evaluating if command near line 58, column 7
error: evaluating for command near line 57, column 5
error: evaluating if command near line 55, column 3
error: called from `findobj' in file `D:\Octave\share\octplot\m\findobj.m'

---------------------------------

Try the following code:
x=[1 2;1 2];
y=[1 1;2 2];
z=[1 3;5 7];
subplot(2,1,1);
pcolor(x,y,z);
caxis([0 4]);
colorbar;
subplot(2,1,2);
pcolor(x,y,z);
colormap("rainbow");
caxis([1 10]);
colorbar;

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Hello all,

    Thanks, for the error report.

    Shai, it seems we have name clash of ishandle. Since octave has ishandle now as builtin function it is called instead of octplot's ishandle.m.

    I propose to rename ishandle.m to oishandle.m and use dispatch to map the ishandle call to 'oishandle.m' then.

    This doesn't solve the problem when trying to create a second colorbar in a figure, but I am working on it.

    Kai

     
  • Shai Ayal

    Shai Ayal - 2007-08-12

    Logged In: YES
    user_id=136223
    Originator: NO

    Kai,

    thanks. I added oishandle & appropriate dispatch to svn revision 480

    Shai

     
  • Nobody/Anonymous

    Logged In: NO

    Hello Shai,

    after looking into the issue it has turned out to be more complicated than initially thought.

    Problem:
    If we consider at least two axes containing plot(s) and two colorbars (axes as well), we have no mapping between the axes (plot) and their colorbar. Therefore we can not delete/overwrite colorbars reliable.

    It seems matlab has some hidden mechanism to link plot and colorbar. At least I have not found any axes property which is used for this. But maybe you have an idea?

    After thinking a bit I have two ways to solve the problem.

    1. The quirky solution: Define a new axes property (e.g. __colobar__) which is used to store the colorbar handle. This could be implemented easily.

    2. More complicated: We define a function which calculates from a given axes handle (double value) a unique handle value for the colorbar. If we create a colorbar for the first time it is used for the handle value. If we call colorbar a second time for an axes, we can use this function to get the unique value, and can check if a colorbar using this handle already exist. If that is the case we can delete/overwrite the old colorbar. This function could simply add 32 to a given axes handle to get the colorbar handle, or something else. But I have no idea how to implement such a function.

    What do you think?

    Kai

     
  • Shai Ayal

    Shai Ayal - 2007-08-17

    Logged In: YES
    user_id=136223
    Originator: NO

    Kai,

    How about using the Tag or UserData properties of the colorbar axes to point to the relevant "parent" axes? Both these properties are not currently implemented, but are easy to add.

    Shai

     
  • Nobody/Anonymous

    Logged In: NO

    Shai,

    since we already have a 'Tag' property - currently it is used to store a "colorbar" tag for the colorbar itself, we can use it to store the handle (converted to a string) of the colorbar "child". O.k. I will propose something using this ideas.

    Kai

     
  • Shai Ayal

    Shai Ayal - 2007-08-17

    Logged In: YES
    user_id=136223
    Originator: NO

    How about using the Tag property of the colorbar instead of the parent axes -- it is more probable that the users will not need any property of the colorbar, while it is possible that they will want to change the Tag property of the regular axes

    Shai

     
  • Kai Habel

    Kai Habel - 2007-08-22

    Logged In: YES
    user_id=96081
    Originator: NO

    Shai,

    I am still not convinced that this is the right approach, this way we lose the explicit information if an axes is a colorbar and the matlab compatibility in that case (matlab sets the axes 'tag' to 'colorbar' for a colorbar).

    But anyway, since it is not *that* important, I have posted a patch set for colorbar.m and caxis.m to the patch tracker. It sets the colorbar-tag to the 'parent' axes handle as you have proposed.

    Kai

     

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.