using imagesc to plot a matrix of data
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to see how temperature varies with different input parameters.
I have 2 input parameters which vary between 0.1-0.5 and 0.1-0.2. I have mean temperature for every combination of these parameters in a 5x2 double.
It generates the graph, but I only want the 0.1 interval labels and not the 0.05 intervals. I've tried to set limits on these but I dont want the position of the 0.1 interval labels to move, and I want to keep these in the centre of the box. Is there a way to do this?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/760611/image.png)
C = 0.1:0.1:0.2;
F = 0.1:0.1:0.5;
figure(1)
subplot(1,3,1)
imagesc(C,F,mean_GT)
set(gca, 'YDir','normal')
xlabel ('Restitution')
ylabel ('Friction')
colorbar
title ('ensemble mean GT')
xlim([0.5,0.2]);
set(gca,'XTick',[0.5:0.1:0.2]);
ylim([0.5,0.5]);
set(gca,'YTick',[0.5:0.1:0.5]);
2 commentaires
Réponse acceptée
Chunru
le 7 Oct 2021
%C = 0.1:0.1:0.2;
C = [0.1 0.2]; % There are only two points along x
F = 0.1:0.1:0.5;
figure(1)
subplot(1,3,1)
mean_GT = randn(5, 2);
imagesc(C,F,mean_GT)
set(gca, 'YDir','normal')
xlabel ('Restitution')
ylabel ('Friction')
colorbar
title ('ensemble mean GT')
%xlim([0.5,0.2]);
set(gca,'XTick',C);
%ylim([0.5,0.5]);
set(gca,'YTick',F);
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Axis Labels 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!