plotting multiple distributions on one graph
8 次查看(过去 30 天)
显示 更早的评论
What I'm wanting is a little complicated.
I have an matrix, simphystate, that is (20x1000), or 20 timesteps x 1000 individuals, and the elements can range from 1 to 15
I want to plot the distribution of simphystate over each timestep, but I want to exclude points where the element of an individual at any given timestep is 1 (these individuals are dead)
plotting a histogram with so many distributions just blurs together, so I was thinking I could just plot the line representing the distribution. Something that would look like this :
is this possible?
0 个评论
采纳的回答
Star Strider
2024-10-8
I am not certain what your data are, so I will create some.
A = randn(20, 1000);
A = (A - min(A,[],2)) + 1;
A = A .* 15./max(A,[],2) + randi(9, 20, 1);
for k = 1:size(A,1)
pd{k} = fitdist(A(k,:).', 'normal');
end
x = linspace(1, 30, 150);
figure
hold on
for k = 1:size(A,1)
plot(x, pdf(pd{k},x), "DisplayName","Row "+k)
end
grid
legend('Location','best')
You could also use plot3 for this, and separate the individual distributions by row number.
.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!