contour plot decimal places label
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
antonio ferreira
le 23 Jan 2018
Réponse apportée : Walter Roberson
le 4 Fév 2018
Hello,
I am trying to plot a contour so that in each countour line a value (label) appears. At the moment the number of decimal places appearing in the label is 4, is there any way to force matlab to present only one decimal place, having for example 32.0, 40.4, etc. ?
Below is the code I am presently using. Thanks in advance for any help.
figure(f1)
subplot(3,1,1);
[cs,h]=contourf(xgrid,ygrid,U,10); hold on;
clabel(cs,h);
set(gca, 'CLim', [12 50]);
xlabel('$y$ $(cm)$','interpreter','latex','Fontsize',18,'Fontname','Times'),
ylabel('$z$ $(cm)$','interpreter','latex','Fontsize',18,'Fontname','Times'),
axis([83 92 1.2 3.9]);
colormap('jet')
colorbar
Réponse acceptée
Walter Roberson
le 4 Fév 2018
[cs,h] = contourf(sort(rand(50,50)*10), 20);
clabel(cs,h);
h.LevelList = round(h.LevelList, 1);
0 commentaires
Plus de réponses (2)
antonio ferreira
le 4 Fév 2018
1 commentaire
Walter Roberson
le 4 Fév 2018
Notice the
labels = hContour.TextPrims
So adjust the labels.
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots 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!