How to plot pcolor in matlab

87 views (last 30 days)
vignesh mohan
vignesh mohan on 9 Dec 2021
Commented: Andebo Waza on 31 Dec 2024 at 9:19
Hello everyone,
i want to plot pcolor plot in matlab but i tried i cannot do it. I add my data here and code also
x = [13-04-2021 00:00 13-04-2021 01:00 13-04-2021 02:00 13-04-2021 03:00 13-04-2021 04:00] like this till 14-04-2021 23:00:00
y = [10.23 11.16 12.19 13.31 14.54 15.88 17.35 18.96 20.72 22.66 24.77 27.1 29.65 32.45 35.53 38.92 42.65 46.77 51.32]
z = [2.27E+03 3.94E+03 4.48E+03 6.26E+03 3.18E+03 3.78E+03 5.37E+03 5.60E+03 6.35E+03 8.47E+03 1.05E+04 1.05E+04
1.36E+04 1.12E+04 8.48E+03 3.96E+03 5.84E+03 4.55E+03 3.65E+03 6.17E+03 7.48E+03 6.98E+03 9.84E+03 1.11E+04
5.72E+04 6.90E+04 5.64E+04 4.71E+04 1.94E+04 6.37E+03 6.59E+03 6.89E+03 8.81E+03 9.70E+03 8.11E+03 9.59E+03
1.26E+04 1.34E+04 1.69E+04 1.99E+04 2.18E+04 2.62E+04 2.98E+04 9.09E+03 5.16E+03 8.73E+03 3.96E+03 4.95E+03
5.16E+03 4.06E+03 4.24E+03 6.17E+03 7.99E+03 8.20E+03 6.68E+03 1.07E+04 1.24E+04 1.36E+04 1.78E+04 1.89E+04]
my x data is in one range and y is in another range and my z data is in different size range.
how to plot that graph?
i hope i will get the answer for this thank you in advance.
[x,y] = meshgrid(x,y);
Pcolor(x,y,z);
  5 Comments
vignesh mohan
vignesh mohan on 9 Dec 2021
Hello Rik i had attached reference graph just have a look then you will get some idea
vignesh mohan
vignesh mohan on 9 Dec 2021
Hello Walter sir i had attached some sample data sheet also. my column name should come in my y-axis date will come in my x-axis remaining all will come in z-axis.
i hope you will help me to come out from this sir i tired many way.
Thank you

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 9 Dec 2021
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/828415/Book1.xlsx';
T = readcell(filename);
x = [T{2:end,1}];
y = cell2mat(T(1,2:end));
z = cell2mat(T(2:end,2:end));
surf(x, y, z.', 'edgecolor', 'none');
  34 Comments
Walter Roberson
Walter Roberson on 30 Dec 2024 at 21:23
Sorry, I do not know how to read python. In particular I do not know the meaning of np.ma.array especially in conjugation with the mask= parameter.
Andebo Waza
Andebo Waza on 31 Dec 2024 at 9:19
@Walter Roberson, No worries. I managed to write the code.

Sign in to comment.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!