How to have a surf plot displayed in a GUI (not as an external figure).
29 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm needing to have a surf plot displayed in the GUI I'm working on, not as an external figure. This is to display the various frequencies across time. This is the code I have at the moment.
[sabz,cFreq,timeInst] = spectrogramAnal(app.trace,app.Fs,app.baseline(1),app.baseline(2));
surf(app.UIAxes,timeInst, cFreq, sabz, 'EdgeColor', 'none');
axis xy;
axis tight;
colormap(jet); view(0,90);
caxis([0, 10]);
xlabel('Time (s)');
colorbar;
ylabel('Frequency (Hz)');
The spectrogramAnal function just sets up the data for the surf plot. My masters supervisor wrote the script for a surf plot to be done as an external figure but wants me to make it so that it will display the plot in the app itself. However, I can't seem to get it to work. Any ideas?
8 commentaires
Mark Gauthier-Braham
le 29 Mai 2020
Modifié(e) : Cris LaPierre
le 29 Mai 2020
Cris LaPierre
le 29 Mai 2020
And if you remove the app.UIAxes from you updated code, does the surf plot appear still correctly in an external figure window?
Réponses (1)
Ameer Hamza
le 30 Mai 2020
You need to pass app.UIAxes to all the other functions too. Otherwise, they will also create a new figure window.
surf(app.UIAxes, timeInst, cFreq, sabz, 'EdgeColor', 'none');
axis(app.UIAxes, 'xy');
axis(app.UIAxes, 'tight');
colormap(app.UIAxes, jet);
view(app.UIAxes, [0,90]);
caxis(app.UIAxes, [0, 10]);
xlabel(app.UIAxes, 'Time (s)');
ylabel(app.UIAxes, 'Frequency (Hz)');
colorbar(app.UIAxes);
0 commentaires
Voir également
Catégories
En savoir plus sur Graphics Performance 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!