How to add custom Yaxis option for UIAxes via Editfield(Numeric) while plotting in matlab appdesigner (Ver 2020a)
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
i m trying to give user option to set Y-axis for the plot axis. so user can limit the axis at it own preference
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/383153/image.jpeg)
i take two simple Variable data lets say
a = [1 2 3 4 5];
b = [2 6 3 8 5];
plot(app.UIAxes,a,b);
then in "plot" button callback i defined
value = app.YAxisMinValueEditField.Value;
app.UIAxes.XAxis = value;
but it gives error that
"You cannot set the read-only property 'XAxis' of UIAxes."
kindly suggest a solution...currently i m trying only for min value editfield.
0 commentaires
Réponse acceptée
Adam Danz
le 16 Oct 2020
ymin = app.YAxisMinValueEditField.Value;
ymax = app.YAxisMaxValueEditField.Value; % I'm guessing this handle
ylim(app.UIAxes, [ymin, ymax])
3 commentaires
Adam Danz
le 17 Oct 2020
if app.AxisCheckBox.Value
app.p = plot(app.UIAxes,app.a,app.b);
ymin = app.YAxisMinValueEditField.Value;
ymax = app.YAxisMaxValueEditField.Value;
ylim(app.UIAxes, [ymin, ymax]);
else
plot(app.UIAxes,app.a,app.b);
% You forgot to implement the ylim here
end
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Graphics Objects dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!