plot
Functions and attributes
- atomman.plot.interpolate_contour(system: System, prop_name: str, prop_index: Optional[Union[int, tuple]] = None, prop_magnitude: bool = False, prop: Optional[Union[int, Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], _SupportsArray[dtype], Sequence[_SupportsArray[dtype]], Sequence[Sequence[_SupportsArray[dtype]]], Sequence[Sequence[Sequence[_SupportsArray[dtype]]]], Sequence[Sequence[Sequence[Sequence[_SupportsArray[dtype]]]]], bool, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]]] = None, plotxaxis: str = 'x', plotyaxis: str = 'y', xlim: Optional[tuple] = None, ylim: Optional[tuple] = None, zlim: Optional[tuple] = None, vlim: Optional[tuple] = None, xbins: int = 200, ybins: int = 200, dots: bool = True, colorbar: bool = True, vzero: bool = True, title: Union[bool, str] = True, length_unit: str = 'angstrom', prop_unit: Optional[str] = None, cmap: str = 'jet', fill_value: float = nan, figsize: Optional[Union[int, float, tuple]] = None, matplotlib_axes: Optional[axes] = None) Tuple[float, float, Optional[figure]]
Creates a contour plot of a system’s per-atom properties by interpolating properties between atoms.
- Parameters:
system (atomman.System) – The system with the per-atom property that you want to plot.
propname (str) – The name of the per-atom property that you want to plot.
prop (array-like object, optional) – Values for the per-atom property to plot. If not given, values will be taken as the “name” property of system.
propindex (int or tuple, optional) – Specifies which component of a multidimensional property to plot. Not needed if the property is scalar.
magnitude (bool, optional) – If True, plots the per-atom magnitude of a vector property. Cannot be combined with index. Default value is False.
plotxaxis (str or array-like object, optional) – Indicates the Cartesian direction associated with the system’s atomic coordinates to align with the plotting x-axis. Values are either 3D unit vectors, or strings ‘x’, ‘y’, or ‘z’ for the Cartesian axes directions. plotxaxis and plotyaxis must be orthogonal. Default value is ‘x’ = [1, 0, 0].
plotyaxis (str or array-like object, optional) – Indicates the Cartesian direction associated with the system’s atomic coordinates to align with the plotting y-axis. Values are either 3D unit vectors, or strings ‘x’, ‘y’, or ‘z’ for the Cartesian axes directions. plotxaxis and plotyaxis must be orthogonal. Default value is ‘y’ = [0, 1, 0].
xlim (tuple, optional) – The minimum and maximum coordinates along the plotting x-axis to include in the fit. Values are taken in the specified length_unit. If not given, then the limits are set based on min and max atomic coordinates along the plotting axis.
ylim (tuple, optional) – The minimum and maximum coordinates along the plotting y-axis to include in the fit. Values are taken in the specified length_unit. If not given, then the limits are set based on min and max atomic coordinates along the plotting axis.
zlim (tuple, optional) – The minimum and maximum coordinates normal to the plotting axes (i.e. plotxaxis X plotyaxis) to include in the fit. Values are taken in the specified length_unit. If not given, then the limits are set based on min and max atomic coordinates along the axis.
vlim (tuple, optional) – Allows for the color range to be specified. If not give, the range will be auto-selected based on the vzero parameter.
xbins (int, optional) – Specifies the number of interpolation bins to use along the plotting x-axis. Default value is 200.
ybins (int, optional) – Specifies the number of interpolation bins to use along the plotting y-axis. Default value is 200.
dots (bool, optional) – If True, then the positions of the atoms are shown as circles. Default value is True.
vzero (bool, optional) – Specifies how to auto-select the vlim values if vlim is not directly given. vzero=True (default) will center the range around 0, i.e. vlim[0] = -vlim[1]. vzero=False will select vlim[0] and vlim[1] independently based on the the property values.
colorbar (bool, optional) – If True (default) a colorbar will be added to the plot.
title (bool or str, optional) – If True (default), a plot title will be added matching the property name plus index/magnitude info. If False, no title will be used. If a string is given, then that will be used instead of the property name.
length_unit (str, optional) – The units of length to use for the plotting x- and y-axes. Default value is ‘angstrom’.
prop_unit (str or None, optional) – The units to use for the property value being plotted. Default value is None, in which no unit conversion is applied.
cmap (str, optional) – The name of the matplotlib colormap to use. Default value is ‘jet’.
fill_value (float, optional) – Value used to fill in for grid points failed to interpolate in the fit. If not given, then the default is np.nan, which may cause an error in plotting for too narrow xlim and ylim settings.
figsize (int, float or tuple, optional) – Specifies the size of the figure to create in inches. Note the plot itself is always made based on an equal aspect ratio of the coordinates. If a single value is given, then the size of the larger dimension will be set to this and the smaller dimension will be scaled accordingly. The width or height can be directly set to a specific value by giving (w, None) or (None, w), respectively. If you give values for both width and height the width value affects the size of the plot and height affects the size of the colorbar if one is included.
matplotlib_axes (matplotlib.Axes.axes, optional) – An existing matplotlib axes object. If given, the differential displacement plot will be added to the specified axes of an existing figure. This allows for subplots to be constructed. Note that figsize will be ignored as the figure would have to be created beforehand and no automatic optimum scaling of the figure’s dimensions will occur.
- Returns:
intsum (float) – The area integrated sum of the property over the plotted region.
avsum (float) – The average property value taken across all plotting bins.
figure (matplotlib.pyplot.figure) – The generated figure object is returned if matplotlib_axes is not given.