From: Corrado Corrado on 13 Aug 2010 09:49 i am using "contour" for plotting matrix data and i have the need to label a single curve in the plot with text value instead of numerical value. Is it possible to do that with clabel?
From: Rich Ellis on 13 Aug 2010 14:50 "Corrado Corrado" <copellac(a)yahoo.it> wrote in message news:i43igg$1jm$1(a)fred.mathworks.com... >i am using "contour" for plotting matrix data and i have the need to label >a single curve in the plot with text value instead of numerical value. Is >it possible to do that with clabel? > Note the following informatin in the documentation for clabel: text_handles = clabel(...) returns the handles of text objects created by clabel. The UserData properties of the text objects contain the contour values displayed. If you call clabel without the h argument, text_handles also contains the handles of line objects used to create the '+' symbols. For example, suppose this is your contour graph: [x,y] = meshgrid(-2:.2:2);z = x.^exp(-x.^2-y.^2);[C,h] = contour(x,y,z); ht = clabel(C,h); Find the contour interval you want to replace with text (assume you want to replace level 0 with 'Sea-Level') and set the String property of the appropriate text object with that character string: for k=1:length(ht) if get(ht(k),'UserData') == 0 set(ht(k),'String','Sea-Level') end end
|
Pages: 1 Prev: compiling matlab .m / generating .c (c code) from .m Next: select all Constant blocks |