Using a Checkbox to add/ remove Text in contourplot in Appdesigner
8 views (last 30 days)
Show older comments
Jan Kosytorz
on 14 Sep 2021
Answered: Cris LaPierre
on 15 Sep 2021
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 Comments
Accepted Answer
Cris LaPierre
on 15 Sep 2021
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 Comments
More Answers (0)
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!