Using contourfcmap in Matlabs App Designer:
Afficher commentaires plus anciens
Hello!
I really like the benefits of contourfcmap (Matlab Exchange) over contourf and would like to use it in Matlabs App Designer.
Unfortunately contourfcmap doesn't support the format Matlabs App Designer is using for plotting.
I need to specifically adress app.UIAxes.
works: contourf(app.UIAxes, X, Y, Z, 10)
doesn't work: contourfcmap(app.UIAxes, X, Y, Z, 10)
Is there a quick way to make contourfcmap useable for Matlabs App Designer or any workaround?
Thanks a lot in advance!
Kind Regards,
Steve
Testapp (Push button to Plot in app.UIAxes)
function ButtonPushed(app, event)
% Callback function for PlotButton
x = linspace(-2, 2, 100);
y = linspace(-2, 2, 100);
[X, Y] = meshgrid(x, y);
Z = exp(-X.^2 - Y.^2);
contour_levels = linspace(min(Z(:)), max(Z(:)), 10);
cmap = jet(length(contour_levels)-1);
cmap_lowest = [0 0 1];
cmap_highest = [1 0 0];
hc = contourfcmap_app(app.UIAxes, x, y, Z, contour_levels, cmap, ...
'lo', cmap_lowest, ...
'hi', cmap_highest, ...
'cbarloc', 'eastoutside', ...
'method', 'calccontour');
end
1 commentaire
Steve
le 22 Oct 2024
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Contour Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!