Clear Filters
Clear Filters

when using copyobj() with a contour, changing properties of the copy has no effect

3 views (last 30 days)
Hello MatLabers
I'm using a contour plot on several axes. Since I have quite an amount of points, the calculation of the contour ([C,h]=contour(...)) takes quite a while (~10secs) and I therefore copy the contour to the different axes. Plus I create the contour on a temporary axes (for I pass the copy to an object which does not know of the current axes)
f = figure('visible','off') % hidden
tmpax = axes('parent',f);
[C,rc]= contour(tmpax,M,v);
from this point i can change properties (e.g. enable/disable the text:
I then pass the handle to my object (class which is also a handle class), which has a property calld "theContour" and an axes "ax" to the following:
function addContour(this, conthandle)
delete(this.theContour); % delete the previous contour
% if there is one already
catch e
this.theContour= copyobj(conthandle,;
this works perfectly fine. The contour is copied and displayed.
However, I would now like to be able to enable/disable the contour labels. I have a method to do so where I call
set(this.theContour,'ShowText','on'); % or off
this has no influence. The only property that I can change on the copied object is "visible". I also tried to use clabel to enable/disable the labels:
C = get(this.theContour,'ContourMatrix');
text_handle = clabel(C,this.theContour,'LabelSpacing',200);
which has no infuence at all...
any help would be greatly appreciated.

Accepted Answer

Jonas Reber
Jonas Reber on 1 Nov 2011
mathworks technical support confirmed that this is a misbehaviour and that it will be resolved in a future version.

More Answers (0)


Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!