Matlab Contour Plot of 37380x2 array data points

조회 수: 11 (최근 30일)
Kelly McGuire
Kelly McGuire 2024년 3월 4일
댓글: Kelly McGuire 2024년 3월 6일
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
Voss
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
Kelly McGuire 2024년 3월 6일
@Voss Thanks, that worked.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile 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!

Translated by