From: James on
Howdy,

I am trying to overlay several contour plots (e.g. pork chop plots). Normally this is straightforward:

figure;
contour(x1,y1,z1,'r');
clabel()
hold on
contour(x2,y2,z2,'b');
clabel()

In my case, the second contour plot will not drawn on the figure when the contour() command is called, and the subsequent clabel() command crashes MATLAB. Each contour plot is successful if they are in their own figure (i.e. make two figures), but I can't copy/paste one contourgroup from one axes object to another successfully.

I've tried all three renderers (painters, zbuffer, opengl hardware/software), as well as updating graphics drivers (MESA 7.7, 7.8). I've tried the available opengl workarounds as well.

I'm using MATLAB R2009a, Ubuntu 9.10, and with an Intel GMA965 graphics card. I know the linux intel drivers are not exactly stellar, but I don't have a choice.

Anybody else have any ideas?
From: Walter Roberson on
James wrote:

> I am trying to overlay several contour plots (e.g. pork chop plots).
> Normally this is straightforward:
>
> figure;
> contour(x1,y1,z1,'r');
> clabel()
> hold on
> contour(x2,y2,z2,'b');
> clabel()

> In my case, the second contour plot will not drawn on the figure when
> the contour() command is called, and the subsequent clabel() command
> crashes MATLAB. Each contour plot is successful if they are in their own
> figure (i.e. make two figures), but I can't copy/paste one contourgroup
> from one axes object to another successfully.

In 2009b, clabel() by itself is not a valid command. If I alter your sequence to

[cs, h] = contour(x1,y1,z1,'r');
clabel(cs,h);
hold on
[cs2, h2] = contour(x2,y2,z2,'b');
clabel(cs2,h2);

then it works for me, where x1, y1, x2, y2 are each rand(1,10) and z1 and z2
are each rand(10,10).

I don't know how to tell which Ubuntu I am running; uname reports
2.6.24-26-generic and I know it is a 32 bit machine.

Also another difference is that I'm running Matlab itself on a 64 bit server
which is displaying to the Ubuntu desktop (via X).
From: James on
Thanks Walter. Good to know it does work on other systems. The clabel() does indeed take arguments, I just didn't bother including them. I really should have, sorry about that.

I'm fairly certain this is a hardware-specific problem, as opposed to a MATLAB coding issue.

The only workaround I found was to overlay multiple transparent axes to contain the different contour plots.

Your Ubuntu version is available in the System->About Ubuntu dialog if you are running Gnome, not sure about the other window managers.

>
> In 2009b, clabel() by itself is not a valid command. If I alter your sequence to
>
> [cs, h] = contour(x1,y1,z1,'r');
> clabel(cs,h);
> hold on
> [cs2, h2] = contour(x2,y2,z2,'b');
> clabel(cs2,h2);
>
> then it works for me, where x1, y1, x2, y2 are each rand(1,10) and z1 and z2
> are each rand(10,10).
>
> I don't know how to tell which Ubuntu I am running; uname reports
> 2.6.24-26-generic and I know it is a 32 bit machine.
>
> Also another difference is that I'm running Matlab itself on a 64 bit server
> which is displaying to the Ubuntu desktop (via X).