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!
