Using a Checkbox to add/ remove Text in contourplot in Appdesigner
조회 수: 8 (최근 30일)
이전 댓글 표시
Hey,
i'm would like to know, how to use a Checkbox to activate the text of the ISO- Lines in a contourf- plot in the Matlab Appdesigner.
Usually i write this in Scripts:
[c1,p1] = contourf(x,y,z,numberofISOlines);
clabel(c1,p1,'FontWeight','bold','FontSize',4,'Color','w','FontName','Courier');%Example
So in Appdesigner i wrote:
contourf(app.UIAxes1,x,y,z,numberofISOlines);
..and tried to activate Text with a checkbox in the same way i used to activate for example a colormap:
This works:
function ColorbarCheckBoxValueChanged(app, event)
valuecolormap = app.ColorbarCheckBox.Value;
if valuecolormap == true
colorbar(app.UIAxes1,"eastoutside")
else
colorbar(app.UIAxes1,"off")
end
end
So i can insert a colorbox in my current plot without updating/ recalculating the plots
This doesn't work:
function ISOtextCheckBoxValueChanged(app, event)
valueISOtext = app.ISOtextCheckBox.Value;
if valueISOtext == true
ShowText(app.UIAxes1,'on')
else
ShowText(app.UIAxes1,'off')
end
end
Asan Issue i get this:
Undefined function 'ShowText' for input arguments of type 'matlab.ui.control.UIAxes'.
So i probably use the ShowText in a wrong way .
Does someone have a solution for this? Thanks in advance!
댓글 수: 0
채택된 답변
Cris LaPierre
2021년 9월 15일
You need to use the handle to your contour plot to set the property of ShowText to on or off.
[x,y,z] = peaks;
[C,h] = contour(x,y,z);
h.ShowText='on';
댓글 수: 0
추가 답변 (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!