Problem in making multiple scatterplots/subplots?
4 vues (au cours des 30 derniers jours)
I am suppose to make 9 scatterplots/subplots in one figure/plot (separate is fine too). My data comprises of 4 variables named as G_temp, Aerosols (Aerosols Concentration), Volume and B_temp. I want to check the relationship between these 4 using scatterplots. What I tried to do for single scatterplot till now is:
Data=readtable('F:\My_Table\Data.xlsx', 'Sheet', 1, 'ReadVariableNames', true, 'VariableNamingRule','preserve');
N = 0:50:500; %
hAx=axes; hold on;
hAx.XScale='log'; grid on;
set(gca, 'YDir', 'reverse');
% plotrows function
In the above code I checked relationship between three variables G_Temp, Aerosols and Volume. Also I want to make 3 bins of Volume (0-500, 500-900, 900-inf) and then plot it versus G_temp and Aerosols concentration. The above code is just for 1st bin (0-500) of volume and produces following scatterplot:
If I try to include the fourth variable.
N2 = 0:1:10
Data.BTemp = discretize(Data.B_Temp, N2);
Following is the result. This is for the first bin of volume and first bin of B_Temp.
Actually this is something which I am trying to make:
For the first bin of Energy and B_Temp, check relationship between G_temp and Aerosol conc. Moving to the next column, for the second bin of energy and first bin of B_Temp check relationship between G_temp and Aerosol conc, and so on.
I would really appreciate if someone can tell me how to do this. Thank you.
Data is attached.
Abderrahim. B le 26 Août 2022
If my understanding is correct, there is a function called plotmatrix that comes with MATLAB and that I believe is more suitable for your case.
Below is a example on how to use ithe plotmatrix function.
dataTble = readtable('Data.xlsx', 'Sheet', 1, 'ReadVariableNames', true, 'VariableNamingRule','preserve');
varNames = string(dataTble.Properties.VariableNames);
% plotmatrix only accepts matrix as input argument
Data = table2array(dataTble) ;
[S,AX,BigAx,H,HAx] = plotmatrix(Data,Data ) ;
for ii = 1:4
AX(4,ii).XLabel.String = varNames(1,ii) ;
AX(ii,1).YLabel.String = varNames(1,ii) ;
S(ii,ii).Color = 'k' ; % this is just to highlight a variable when compared to itself.
Note that you still can improve the readability of this plot, for instance changing the color each each axes ..
Hope this helps