Control scale and colors in temperature contour

1 view (last 30 days)
im using this code to plot temperature contour from excel files, the issue is im doing it for different excel files so i want to have a unified scale and not auto scale because range is not the same for my files.so for example i want the range to be always between 28 and 36 . Also i would like to know if i can change/control the colors of the contour.
This is the code im using and ill also attach an example of the excel file im taking data from.
data = readmatrix('a.xlsx');
[m,n] = size(data);
% scale the x / y axis
% create x axis matching range : 0 to 220
% create y axis matching range : 0 to 50
x = (0:n-1)/(n-1)*220;
y = (0:m-1)/(m-1)*50;
% 2D data smoothing
matrixOut = smooth2a(data,10,10);
% or
% matrixOut = smoothn(data,50,'robust');
contourf(x,y,matrixOut);
colorbar('vert')

Accepted Answer

Image Analyst
Image Analyst on 1 Apr 2023
You need to read in all the files first to determine the overall max and min. Then you can create a colormap and apply if to the files as you read them in again.
  6 Comments
Ahmad
Ahmad on 2 Apr 2023
Thanks for your help. I created my own colormap and it works fine
Image Analyst
Image Analyst on 2 Apr 2023
Glad it's working for you. If this, or another, Answer solves your original question best, then could you please click the "Accept this answer" link to award the best answerer with "reputation points" for their efforts in helping you? They'd appreciate it. Thanks in advance. 🙂 Note: you can only accept one answer (so pick the best one) but you can click the "Vote" icon for as many Answers as you want. Voting for an answer will also award reputation points.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!