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

3 vues (au cours des 30 derniers jours)
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:
set(rc,'ShowText','on')
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)
try
delete(this.theContour); % delete the previous contour
% if there is one already
catch e
end
hold(this.ax,'on');
this.theContour= copyobj(conthandle,this.ax);
hold(this.ax,'off');
end
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');
set(this.theContour,'ShowText','on');
hold(this.ax,'on');
text_handle = clabel(C,this.theContour,'LabelSpacing',200);
hold(this.ax,'off');
which has no infuence at all...
any help would be greatly appreciated.

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by