How to plot 3 variables joint probability distribution

11 ビュー (過去 30 日間)
Danupon Subanapong
Danupon Subanapong 2019 年 1 月 1 日
コメント済み: Cris LaPierre 2019 年 1 月 1 日
Hello!!
I would like to ask for some help. I am working on plotting 3 variable joint probability distribution. I have been researching on how to plot for several days, but I have not found any solution yet. I will also attach example of the plot I intend to perform as well as the text file of these joint probability distributions. I really appreciate any help you can provide.

回答 (1 件)

Cris LaPierre
Cris LaPierre 2019 年 1 月 1 日
To create that type of plot, I think you'd want to use surf. However, you would need to first turn your data into matrices (for Z and C at least) for the function surf, mesh, or contour to be able to plot them. See this answer for suggestions.
Currently, there are not enough data points for this approach to create a plot that looks like what you shared.
Perhaps it's simplest to get started using scatter3?
data = readtable(file);
G = findgroups(data.A);
for idx = 1:max(G)
scatter3(data.B(G==idx),data.C(G==idx),data.A(G==idx),15,data.Probability(G==idx))
hold on
end
view(3)
  1 件のコメント
Cris LaPierre
Cris LaPierre 2019 年 1 月 1 日
Also, check out this StackOverflow post.
Perhaps I'm messing up your data somehow, but the plots just don't look anything like what you shared. Could you create a 2D plot of what a single level should look like (for A==1) and share it here?
It doesn't have to be a contour plot - surf, mesh, etc. An image along with the accompanying code for what displays a single level the way you want. Then we can help you figure out how to create a stacked plot of that.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by