How to have a surf plot displayed in a GUI (not as an external figure).
23 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Cris LaPierre
el 29 de Mayo de 2020
And if you remove the app.UIAxes from you updated code, does the surf plot appear still correctly in an external figure window?
Respuestas (1)
Ameer Hamza
el 30 de Mayo de 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 comentarios
Ver también
Categorías
Más información sobre Graphics Performance en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!