when using copyobj() with a contour, changing properties of the copy has no effect
    7 次查看(过去 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!
