Matlab Contour Plot of 37380x2 array data points

12 vues (au cours des 30 derniers jours)
Kelly McGuire
Kelly McGuire le 4 Mar 2024
Commenté : Kelly McGuire le 6 Mar 2024
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 commentaires
Voss
Voss le 6 Mar 2024
"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 le 6 Mar 2024
@Voss Thanks, that worked.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by