plot graph based on given values

I have attached the data of cell count of different type of cells. The cell count of one type cell is given in each sheets .
Based on the attached data, please can someone suggest me what kind of plot to draw with the given data for preliminary data analysis.

 Accepted Answer

Since they are histograms, I would do something like this —
sn = sheetnames('https://www.mathworks.com/matlabcentral/answers/uploaded_files/941694/my_excel_file.xlsx');
ns = numel(sn);
for k1 = 1:ns
figure(k1)
s{k1} = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/941694/my_excel_file.xlsx','sheet',k1);
hb = bar3(s{k1});
colormap(turbo)
for k2 = 1:numel(hb)
hb(k2).CData = hb(k2).ZData;
hb(k2).FaceColor = 'interp';
end
xlabel('x')
ylabel('y')
title(sprintf('%s',sn(k1)))
end
.

12 Comments

What if i would want to plot the mean of the cell count? Will that be suitable for data analysis?
That is for you to decide, since I do not know what you are doing.
Calculating it would be straightforward. What axis (x,y) do you want to take the mean of?
sn = sheetnames('https://www.mathworks.com/matlabcentral/answers/uploaded_files/941694/my_excel_file.xlsx');
ns = numel(sn);
for k1 = 1:ns
figure(k1)
s{k1} = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/941694/my_excel_file.xlsx','sheet',k1);
xmean = mean(s{k1});
ymean = mean(s{k1},2);
subplot(2,1,1)
stairs(xmean)
title('Mean x')
subplot(2,1,2)
stairs(ymean)
title('Mean y')
sgtitle(sprintf('%s',sn(k1)))
end
.
Sir one more doubt, can i do box plot with this data?
Try thjis —
sn = sheetnames('https://www.mathworks.com/matlabcentral/answers/uploaded_files/941694/my_excel_file.xlsx');
ns = numel(sn);
for k1 = 1:ns
s{k1} = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/941694/my_excel_file.xlsx','sheet',k1);
xmean{k1,:} = mean(s{k1},1);
ymean{k1} = mean(s{k1},2);
end
lenx = cellfun(@numel,xmean);
maxlenx = max(lenx);
xmeanm = nan(ns,maxlenx);
for k = 1:ns
xmeanm(1:lenx(k)) = xmean{k};
end
figure
boxplot(xmeanm')
xticklabels(sn)
title('mean x')
figure
boxplot(cell2mat(ymean))
title('mean y')
xticklabels(sn)
This is the best I can do with those data.
.
Thank you so much sir
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
Sir i have one doubt in the boxplot, what does that red colour plus sign (+) ndicate in the box plot of mean_x. But there is no + sign in the boxplot of mean_y. What does that + sign mean?
They plot different data. One plots the mean across the ‘x’ axis and the other plots the means across the ‘y’ axis.
Even though the data are the same for both, the vector of means taken across the rows of the matrix will be different from the vector of means taken across the columns of the matrix.
No sir what does the 3 red plus sign below and 2 red plus sign in the box plot denote, why there is no red plus sign in mean_x of sheet 4 and sheet 5. Why does Sheet 1 and 2 have red plus sign top and bottom, and sheet 3 have only at the bottom? What does that red plus sign indicate?
I was not certain what you were asking about.
From the boxplot documentation:
boxplot(x) creates a box plot of the data in x. If x is a vector, boxplot plots one box. If x is a matrix, boxplot plots one box for each column of x.
On each box, the central mark indicates the median, and the bottom and top edges of the box indicate the 25th and 75th percentiles, respectively. The whiskers extend to the most extreme data points not considered outliers, and the outliers are plotted individually using the '+' marker symbol.
So the red ‘+’ are outliers (extreme values) with respect to the rest of the data. Not every sheet x-mean has outliers.
.
Thank you sir, thats what i asked. Thank you
As always, my pleasure!

Sign in to comment.

More Answers (1)

May be this:
sheets = sheetnames('https://www.mathworks.com/matlabcentral/answers/uploaded_files/941694/my_excel_file.xlsx');
edges = 0:20:1400;
N = zeros(length(sheets),length(edges)-1);
for k = 1:length(sheets)
rawdata = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/941694/my_excel_file.xlsx','Sheet',sheets(k));
[N(k,:),edges] = histcounts(rawdata(:),edges);
end
s = stackedplot(diff(edges)+edges(1:end-1),N','DisplayLabels',compose('Cell #%d',1:length(sheets)));

2 Comments

Elysi Cochin
Elysi Cochin on 26 Mar 2022
Edited: Elysi Cochin on 26 Mar 2022
Sir can you please say what you have plotted? Its the histogram of cell count, correct?
You are right, histogram of cell counts

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!