- position along the x-axis
- position along the y-axis
- "height" (which is represented by color, and by the contour lines)
Matlab Contour Plot of 37380x2 array data points
조회 수: 11 (최근 30일)
이전 댓글 표시
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
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;
답변 (0개)
참고 항목
카테고리
Help Center 및 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!
