plot_gmx_densmap
Read up to three matrices from text files and plot them as one RGB
matrix with matplotlib.axes.Axes.imshow()
.
Each matrix must be stored in a separate text file. The first column of the text files must contain the x values and the first row the y values (note that this is opposed to the standard matrix convention). The value in the upper left corner will be ignored. The remaining elements of the matrix must contain the z values for each (x,y) pair. The file may contain comment lines starting with ‘#’, which will be ignored.
Options
- -r
File containing the matrix that shall be represented as red levels in the final RGB matrix.
- -g
File containing the matrix that shall be represented as green levels in the final RGB matrix.
- -b
File containing the matrix that shall be represented as blue levels in the final RGB matrix.
Note that at least one of the -r, -g and -b flag must be provided. If multiple matrices are given, all matrices must have the same shape and the same x and y values. The input matrices must not contain negative values.
- -o
Output filename.
- -c
Eliminate values below a certain cutoff in the final RGB matrix to suppress noise. The values of each RGB channel are normalized to the interval [0, 1] (not [0,255] as usual). Default:
0
.- --Otsu
Use Otsu’s binarization[1] to automatically calculate a cutoff. If --Otsu is set, -c will be ignored. This option requires the opencv-python package.
- --xylabel
x- and y-axis label. Default:
[r'$x$ / nm', r'$y$ / nm']
.- --xlim
Left and right limit of the x-axis in data coordinates. Pass ‘None’ to adjust the limit(s) automatically. Default:
[None, None]
.- --ylim
Lower and upper limit of the y-axis in data coordinates. Pass ‘None’ to adjust the limit(s) automatically. Default:
[None, None]
.- --xticks-at-yticks
Set x-ticks at the same positions as y-ticks.
See also
scripts.structure.densmap
Compute a 2-dimensional number density map
Notes
This python script is inspired by the work of Hadrian Montes-Campos[2],[3]. It was originally designed to read the output file
that is produced by the GROMACS tool gmx densmap with the ‘-od’ flag
but can equally well read other matrix files (like the one produced by
scripts.structure.densmap
) as long as they are provided in the
specified format.
References
Functions
Read a 2-dimensional matrix from a text file. |