spatial distribution plot in matlab

4 views (last 30 days)
pranto saha
pranto saha on 22 Jul 2023
Answered: Rahul on 5 Sep 2024
I am new in matlab, and currently i want to plot some data in my plot. but i am unable to do this, I want to make a plot like this
i have temperatureData
size of temperatureData = 46 x 241 x 4
in y axis i will show 46 point, x axis 241 point, i need 4 plot for last 4 data. is it possible to make this graph with this data, or i need to modify my data,
if i can , how to do this, please help.

Answers (1)

Rahul
Rahul on 5 Sep 2024
I understand that you have some 'temperatureData' of size 46 x 241 x 4. You want to plot the 'temperatureData' in the way shared by you in the question above.
You can achieve the desired result by following the mentioned code:
figure;
% 'temperatureData' is considered to be a 46 x 241 x 4 matrix as mentioned
% in the question
for i = 1:4
% Extract the 2D slice for the current plot
dataSlice = temperatureData(:, :, i);
subplot(2, 2, i);
contourf(dataSlice, 'LineStyle', 'none');
colorbar;
end
You can also consider using 'imagesc' function instead of the 'contourf' function above for your use-case.
You can refer to the following documentations to know more about these functions and styling:

Categories

Find more on Data Distribution Plots in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!