Matlab Contour Plot of 37380x2 array data points
古いコメントを表示
I have an array of data points, where the first column are RMSD values and represent the x-axis and the second column are RoG values and represent the y-axis. I would like to make a contour plot of RoG (y-axis) vs RMSD (x-axis). I found and tried other code, but I need the color bar to represent the RMSD range instead of the data point density. The Code is shown below. The image shows my plot on the left, and I am trying to make a similar plot to the one on the right. The color bar gives the range of the RMSD values. The y-axis also only shows the minimum to maximum range. I don't need to change the color scheme.
ROGRMSDData is the attached array.

[N,Xedges,Yedges] = histcounts2(ROGRMSDData(:,1), ROGRMSDData(:,2), 50);
% or use [N,Xedges,Yedges] = histcounts2(X,Y,Xedges,Yedges);
% Compute bin centers
Xcnt = Xedges(2:end) - abs(diff(Xedges(1:2))/2);
Ycnt = Yedges(2:end) - abs(diff(Yedges(1:2))/2);
figure()
contourf(Xcnt,Ycnt, N)
% colorbar
cb = colorbar();
10 件のコメント
the cyclist
2024 年 3 月 4 日
I'm confused. Or maybe you are.
To make a contour plot, you need to map three data elements:
- position along the x-axis
- position along the y-axis
- "height" (which is represented by color, and by the contour lines)
You have told us that the first column of data is RMSD, and you want to map that to x.
You have told us that the second column of data is RoG, and you want to map that to y.
You have told us that you do NOT want to map binned data density as the height. (This makes sense to me.)
But ... and this is the part I am confused about ... what DO you want to map to the height?
Kelly McGuire
2024 年 3 月 4 日
編集済み: Kelly McGuire
2024 年 3 月 4 日
Kelly McGuire
2024 年 3 月 5 日
the cyclist
2024 年 3 月 5 日
It is a strange fact that the scale of the colorbar in their figure is the same as the x-axis. But, it can't be that the height is simply equal to RMSD. (If it were, the color would be constant for a given RoG.)
Can you share the source of the figure you are trying to emulate?
Kelly McGuire
2024 年 3 月 5 日
Cris LaPierre
2024 年 3 月 5 日
編集済み: Cris LaPierre
2024 年 3 月 5 日
This looks like a free energy landscape plot (at least based on my web searches)..
I suspect you need to calculate the free energy using the radius of gyration and rmsd values.
See one example here: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7369993/
Kelly McGuire
2024 年 3 月 6 日
編集済み: Kelly McGuire
2024 年 3 月 6 日
Kelly McGuire
2024 年 3 月 6 日
Voss
2024 年 3 月 6 日
"I suspect that's because most of the zValues are NaN"
If you want zeros instead of NaNs there:
zValues(isnan(zValues)) = 0;
Kelly McGuire
2024 年 3 月 6 日
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
