Using a Checkbox to add/ remove Text in contourplot in Appdesigner
2 次查看(过去 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!