using imagesc to plot a matrix of data
1 view (last 30 days)
Show older comments
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?
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]);
Accepted Answer
Chunru
on 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);
More Answers (0)
See Also
Categories
Find more on Axis Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!