Matlab Contour Plot of 37380x2 array data points
Mostrar comentarios más antiguos
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 comentarios
the cyclist
el 4 de Mzo. de 2024
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
el 4 de Mzo. de 2024
Editada: Kelly McGuire
el 4 de Mzo. de 2024
Kelly McGuire
el 5 de Mzo. de 2024
the cyclist
el 5 de Mzo. de 2024
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
el 5 de Mzo. de 2024
Cris LaPierre
el 5 de Mzo. de 2024
Editada: Cris LaPierre
el 5 de Mzo. de 2024
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
el 6 de Mzo. de 2024
Editada: Kelly McGuire
el 6 de Mzo. de 2024
Kelly McGuire
el 6 de Mzo. de 2024
Voss
el 6 de Mzo. de 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
el 6 de Mzo. de 2024
Respuestas (0)
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
