when using copyobj() with a contour, changing properties of the copy has no effect
조회 수: 3 (최근 30일)
이전 댓글 표시
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.
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!