aim2dat.plots
¶
Specific classes to prepare and plot data.
Package Contents¶
Classes¶
Class to plot the band structure combined with the density of states. |
|
Plot the band structure of a crystalline structure. |
|
Class to plot the density of states. |
|
Plot the partial charges. |
|
Plot the partial radial distribution function. |
|
Plot the formation energy of binary and ternary material systems. |
|
Plot scalar planar fields. |
|
Direct and flexible interface to the backend plot libraries. |
|
Plot x-ray absorption spectra. |
|
Plot the surface energy with respect to the chemical potential. |
Functions¶
|
Depreciated band structure class. |
|
Depreciated band structure DOS class. |
|
Depreciated DOS class. |
|
Depreciated PhaseDiagram class. |
|
Depreciated Spectrum class. |
-
class aim2dat.plots.BandStructureDOSPlot(ratio=
(12, 7)
, show_legend=[False, True]
, subplot_hspace=5
, subplot_wspace=0.1
, subplot_nrows=1
, subplot_ncols=3
, subplot_sharex=False
, subplot_sharey=True
, subplot_gridspec=[(0, 1, 0, 2), (0, 1, 2, 3)]
, pdos_plot_type='line'
, tdos_plot_type='fill'
, dos_comp_threshold=0.47
, smearing_method='gaussian'
, smearing_delta=0.005
, smearing_sigma=5.0
, sum_pdos=False
, per_atom=False
, **kwargs)[source]¶ Bases:
aim2dat.plots.base_plot._BasePlot
,aim2dat.plots.base_mixin._HLineMixin
,aim2dat.plots.base_mixin._VLineMixin
,aim2dat.plots.base_band_structure._BaseBandStructure
,aim2dat.plots.base_dos._BaseDensityOfStates
Class to plot the band structure combined with the density of states.
- Variables:¶
- dos_comp_threshold : float¶
Threshold to compare the density of states if
detect_equivalent_kinds
is set toTrue
when importing projected density of states data sets.- sum_pdos : bool¶
Whether to sum all pDOS data sets to obtain a tDOS.
- per_atom : bool¶
Normalize all density of states data sets to the numer of atoms.
Overview
¶ used backend library to plot the data. Supported values are
"matplotlib"
andAlpha value(s) controlling the opacity of plot elements.
Colors used in the plot.
Hatch value(s) controlling the hatch of plot elements.
Line styles used in the plot (This feature is not supported by all plot
Line widths used in the plot (This feature is not supported by all plot
Marker types used in the plot (This feature is not supported by all plot
List of labels for the ticks on the x-axis.
List of values to set ticks on the x-axis.
List of labels for the ticks on the y-axis.
List of values to set ticks on the y-axis.
List of labels for all data sets.
Set equal aspect ratio of the plot(s).
Shift between box and anchor. The default value is
(1, 1)
.Location of the legend. The default value is
1
.Columns of the legend (only supported for the matplotlib backend).
Sort entries of the legend.
plot type of the pDOS data sets, supported options are
'line'
,'fill'
Whether to draw a grid in the plot. The default value is
False
.Length-to-width ratio of the plot given as a tuple of two numbers.
Show colorbar (not supported by all plots).
Whether to draw a grid in the plot. The default value is
False
.Show legend. The default value is
False
.Show plot. The default value is
False
.Spacing between two values. If set to
None
the original function isMethod used to smear out the functions. Supported options are
'gaussian'
andSigma value of the smearing distribution.
Path of the folder to store the plot. The default value is
./
.Store plot. The default value is
False
.Custom matplotlib style sheet.
Keyword arguments for the matplotlib
subplots_adjust
function.Align y label of plot. The default value is
False
.Grid spec values.
Vertical spacing between the subplots.
Number of columns. The default value is
1
.Number of rows. The default value is
2
.Use one common colorbar for all subplots.
Merge legend items of all subplots.
Share the x-axis of subplots located in the same column.
Share the y-axis of subplots located in the same row.
Title of the whole figure.
x-label of the whole figure.
y-label of the whole figure.
Tight layout of plot. The default value is
False
.Horizontal spacing between the subplots.
plot type of the tDOS data sets, supported options are
'line'
,'fill'
Label of the x-axis. If
None
is given no label will be shown. TheRange of the x-axis. The default value is
None
.Label of the y-axis. If
None
is given no label will be shown. TheRange of the y-axis. The default value is
None
.¶ add_hline
(y, x_min, x_max, color, line_style, scaled, foreground, subplot_assignment, data_label)Add a vertical line to the plot.
add_vline
(x, y_min, y_max, color, line_style, scaled, foreground, subplot_assignment, data_label)Add a vertical line to the plot.
analyse_band
(data_label, band_idx)Calculate the minimum and the maximum energy of the band as well as their k-points.
auto_set_axis_properties
(set_x_label, set_y_label)Whether the axis labels and other axis properties are auto-generated.
calculate_band_gap
(data_label, vbm_band_idx)Calculate the direct and indirect band gap of the band structure.
calculate_energy_diff_at_kpoint
(data_labels, band_idx1, band_idx2, kpoint)Calculate the energy difference between two bands at a certain k-point.
calculate_smallest_direct_energy_diff
(data_label, band_idx1, band_idx2)Calculate the smallest direct energy difference between two bands.
calculate_smallest_energy_diff
(data_label, band_idx1, band_idx2)Calculate the smallest energy difference between two bands.
create_default_gridspec
(nrows, ncols, nplots, heights, widths, center_last_row)Create default grid for multiple plots.
import_band_structure
(data_label, kpoints, bands, path_labels, occupations, unit_y, align_to_vbm)Import a data set.
import_from_aiida_bandsdata
(data_label, bandsdata_node, align_to_vbm)Read band structure from an aiida bandsdata node.
import_from_aiida_xydata
(data_label, pdosdata, shift_dos, use_smearing, sum_kinds, sum_principal_qn, sum_azimuth_qn, sum_magnetic_qn, detect_equivalent_kinds, custom_kind_dict)Read projected density of states from an AiiDA xy-data node.
import_projected_dos
(data_label, energy, pdos, unit_x, shift_dos, use_smearing, sum_kinds, sum_principal_qn, sum_azimuth_qn, sum_magnetic_qn, detect_equivalent_kinds, custom_kind_dict)Import projected density of states.
import_total_dos
(data_label, energy, tdos, use_smearing, unit_x, shift_dos)Import total density of states.
plot
(data_labels, plot_title, plot_name, subplot_assignment)Plot the data sets.
Remove all added plot elements.
Reset gridspec settings.
Return the labels of all data sets.
set_reference_cell
(reference_cell)Set reference cell.
shift_bands
(data_label, energy_shift, spin)Shift the bands of one data set.
shift_bands_and_dos
(data_label, shift)Shift band structure and density of states.
shift_bands_and_dos_to_vbm
(data_label)Shift the bands and the density of states such that the VBM is zero.
shift_dos
(data_label, shift)Shift density of states.
- property backend¶
used backend library to plot the data. Supported values are
"matplotlib"
and"plotly"
.- Type:¶
str
- property custom_alpha¶
Alpha value(s) controlling the opacity of plot elements.
- Type:¶
float, list or tuple
- property custom_hatch¶
Hatch value(s) controlling the hatch of plot elements.
- Type:¶
float, list or tuple
- property custom_linestyles¶
Line styles used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_linewidths¶
Line widths used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_markers¶
Marker types used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property legend_bbox_to_anchor¶
Shift between box and anchor. The default value is
(1, 1)
.- Type:¶
tuple or list
- property pdos_plot_type¶
plot type of the pDOS data sets, supported options are
'line'
,'fill'
and'linefill'
.- Type:¶
str
- property ratio¶
Length-to-width ratio of the plot given as a tuple of two numbers.
- Type:¶
tuple or list
- property smearing_delta¶
Spacing between two values. If set to
None
the original function is used.- Type:¶
float or None
- property smearing_method¶
Method used to smear out the functions. Supported options are
'gaussian'
and'lorentzian'
.- Type:¶
str
Use one common colorbar for all subplots.
bool
Merge legend items of all subplots.
bool
Share the x-axis of subplots located in the same column.
bool
Share the y-axis of subplots located in the same row.
bool
- property tdos_plot_type¶
plot type of the tDOS data sets, supported options are
'line'
,'fill'
and'linefill'
.- Type:¶
str
- property x_label¶
Label of the x-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
- property y_label¶
Label of the y-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
-
add_hline(y, x_min, x_max, color=
None
, line_style=None
, scaled=False
, foreground=False
, subplot_assignment=None
, data_label=None
)¶ Add a vertical line to the plot.
- Parameters:¶
y (float) – y-position of the line.
x_min (float) – Bottom x-position of the line.
x_max (float) – Top x-position of the line.
color (str or None) – Color of the line.
line_style (str or None) – Line style of the line.
scaled (bool) – Whether the input is given in scaled positions.
foreground (bool) – Whether to plot the line in front of the other elements.
subplot_assignment (list or None) – Assignment of the line to individual subplots.
-
add_vline(x, y_min, y_max, color=
None
, line_style=None
, scaled=False
, foreground=False
, subplot_assignment=None
, data_label=None
)¶ Add a vertical line to the plot.
- Parameters:¶
x (float) – x-position of the line.
y_min (float) – Bottom y-position of the line.
y_max (float) – Top y-position of the line.
color (str or None) – Color of the line.
line_style (str or None) – Line style of the line.
scaled (bool) – Whether the input is given in scaled positions.
foreground (bool) – Whether to plot the line in front of the other elements.
subplot_assignment (list or None) – Assignment of the line to individual subplots.
- analyse_band(data_label, band_idx)¶
Calculate the minimum and the maximum energy of the band as well as their k-points.
- Parameters:¶
data_label (str) – Internal label of the data set.
band_idx (int) – Index of the band that is analysed.
- Returns:¶
band_min (dict) – Dictionary containing the minimum energy and the corresponding k-point.
band_max (dict) – Dictionary containing the maximum energy and the corresponding k-point.
-
auto_set_axis_properties(set_x_label=
True
, set_y_label=True
)¶ Whether the axis labels and other axis properties are auto-generated.
- Parameters:¶
set_x_label (bool) – Set x-axis label automatically.
set_y_label (bool) – Set y-axis label automatically.
-
calculate_band_gap(data_label, vbm_band_idx=
None
)¶ Calculate the direct and indirect band gap of the band structure.
With the parameter
vbm_band_idx
the index of the highest valence band can be passed on.Otherwise, if the occupations are given for the eigenvalues, the highest valence band and lowest conduction band are determined based on the occupation number; an occupation below 0.5 is considered as unoccupied.
If the previous cases do not apply the energy level 0~eV is considered to be within the band gap.
- Parameters:¶
data_label (str) – Internal label of the data set.
vbm_band_idx (int or list (optional)) – Index of the highest occupied band. In case of spin non-degenerate calculations a list of two indices can be given (otherwise the indices for spin-up and spin-down channels are assumed to be the same). If an occupation list is not available this parameter is used to calculate the band gap. Default value is
Ǹone
.
- Returns:¶
band_gap (dict or list) – A dictionary containing information on the size and nature of the band gap, e.g.
{'direct_gap': 2.605352729999999, 'direct_gap_kpoint': [0.0, 0.0, 0.0], 'indirect_gap': 0.6067583699999997, 'vbm_kpoint': [0.0, 0.0, 0.0], 'vbm_energy': 0.0, 'vbm_band_idx': 3, 'cbm_kpoint': [0.41447368, 0.0, 0.41447368], 'cbm_energy': 0.6067583699999997, 'cbm_band_idx': 4}
. In case of spin non-degeneracy the dictionary is given for both spins as a list of dictionaries.
- calculate_energy_diff_at_kpoint(data_labels, band_idx1, band_idx2, kpoint)¶
Calculate the energy difference between two bands at a certain k-point.
- Parameters:¶
data_labels (str or list) – Internal labels of the data sets. In case only one label is given as a string both bands are assumed to be part of the same data set.
band_idx1 (int) – Index of the first band.
band_idx2 (int) – Index of the second band.
kpoint (list) – K-point at which the difference is calculated.
- Returns:¶
energy_diff (float) – Energy difference between the two bands.
- calculate_smallest_direct_energy_diff(data_label, band_idx1, band_idx2)¶
Calculate the smallest direct energy difference between two bands.
- Parameters:¶
data_label (str) – Internal label of the data set.
band_idx1 (int) – Index of the first band.
band_idx2 (int) – Index of the second band.
- Returns:¶
energy_diff (dict or list) – Dictionary containing the energy difference and the k-points of the band maximum and band minimum, e.g.:
{'energy': 2.605352729999999, 'kpoint': [0.0, 0.0, 0.0]}
. In case of spin non-degeneracy the dictionary is given for both spins as a list of dictionaries.
- calculate_smallest_energy_diff(data_label, band_idx1, band_idx2)¶
Calculate the smallest energy difference between two bands.
- Parameters:¶
data_label (str) – Internal label of the data set.
band_idx1 (int) – Index of the first band.
band_idx2 (int) – Index of the second band.
- Returns:¶
energy_diff (dict or list) – Dictionary containing the energy difference and the k-points of the band maximum and band minimum, e.g.:
{'energy': 3.7729889100000005, 'kpoint_min': [0.5, 0.25, 0.75], 'kpoint_max' : [0.5, 0.25, 0.75]}
. In case of spin non-degeneracy the dictionary is given for both spins as a list of dictionaries.
-
create_default_gridspec(nrows, ncols, nplots, heights=
1
, widths=1
, center_last_row=True
)¶ Create default grid for multiple plots.
- Parameters:¶
nrows (Int) – Number of rows.
ncols (int) – Number columns.
nplots (int) – Number of subplots.
heights (int (optional)) – Height of subplots.
widths (int (optional)) – Width of subplots.
center_last_row (bool (optional)) – Center the plots of the last row.
-
import_band_structure(data_label, kpoints, bands, path_labels=
None
, occupations=None
, unit_y='eV'
, align_to_vbm=False
)¶ Import a data set.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
kpoints (list) – List of k-points.
bands (list) – List of eigenvalues (nkpoints x neigenvalues or nspins x nkpoints x neigenvalues).
path_labels (list (optional)) – List of path labels.
occupations (list (optional)) – List of occupations.
unit_y (str (optional)) – Unit to be used in the y-label.
align_to_vbm (bool) – Whether the bands should be aligned to the valence band maximum. Works only if occupation numbers are given. A band is defined as unoccupied if the number of electrons is below 0.5.
-
import_from_aiida_bandsdata(data_label, bandsdata_node, align_to_vbm=
False
)¶ Read band structure from an aiida bandsdata node.
- Parameters:¶
data_label (str) – Internal label of the data set.
bandsdata_node (aiida.bands, int or str) – Data node containing the band structure or its primary key or uuid.
align_to_vbm (bool) – Whether the bands should be aligned to the valence band maximum. Works only if occupation numbers are given. A band is defined as unoccupied if the number of electrons is below 0.5. The default value is
False
.
-
import_from_aiida_xydata(data_label, pdosdata, shift_dos=
0.0
, use_smearing=False
, sum_kinds=False
, sum_principal_qn=True
, sum_azimuth_qn=False
, sum_magnetic_qn=True
, detect_equivalent_kinds=False
, custom_kind_dict=None
)¶ Read projected density of states from an AiiDA xy-data node.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
pdosdata (aiida.orm.array.xy or dict) – AiiDA data node or dictionary of AiiDA data nodes for each kind.
shift_dos (float) – Shift the density of states by constant value. The default value is
0.0
.use_smearing (bool (optional)) – Whether to smear out the density of states. The default value is
False
.sum_kinds (bool (optional)) – Whether to sum different kinds of the same element. The default value is
False
.sum_principal_qn (bool (optional)) – Whether to sum up the principal quantum numbers. The default value is
True
.sum_azimuth_qn (bool (optional)) – Whether to sum up the azimuth quantum numbers.
sum_magnetic_qn (bool (optional)) – Whether to sum up the magnetic quantum numbers. The default value is
True
.detect_equivalent_kinds (bool (optional)) – Tries to identify equivalent sites by calculating the difference of the projected densities at each energy value. The default value is
False
.custom_kind_dict (dict or None (optional)) – Group the projected densities and put custom labels, e.g.
{"label_1": (0, 1, 2), "label_2": (3, 4, 5)}
.
-
import_projected_dos(data_label, energy, pdos, unit_x=
'eV'
, shift_dos=0.0
, use_smearing=False
, sum_kinds=False
, sum_principal_qn=True
, sum_azimuth_qn=False
, sum_magnetic_qn=True
, detect_equivalent_kinds=False
, custom_kind_dict=None
)¶ Import projected density of states.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
energy (list) – List of energy values.
pdos (list) – List of projected density of states data. The list should consist of dictionaries with the orbital labels as keys and the pdos as values. Additionallly, the element and/or kind of the atom should be included.
unit_x (str (optional)) – Unit of the energy. The default value is
'eV'
.shift_dos (float (optional)) – Shift the density of states by constant value. The default value is
0.0
.use_smearing (bool (optional)) – Whether to smear out the density of states. The default value is
False
.sum_kinds (bool (optional)) – Whether to sum different kinds of the same element. The default value is
False
.sum_principal_qn (bool (optional)) – Whether to sum up the principal quantum numbers. The default value is
True
.sum_azimuth_qn (bool (optional)) – Whether to sum up the azimuth quantum numbers.
sum_magnetic_qn (bool (optional)) – Whether to sum up the magnetic quantum numbers. The default value is
True
.detect_equivalent_kinds (bool (optional)) – Tries to identify equivalent sites by calculating the difference of the projected densities at each energy value. The default value is
False
.custom_kind_dict (dict or None (optional)) – Group the projected densities and put custom labels, e.g.
{"label_1": (0, 1, 2), "label_2": (3, 4, 5)}
.
-
import_total_dos(data_label, energy, tdos, use_smearing=
False
, unit_x='eV'
, shift_dos=0.0
)¶ Import total density of states.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
energy (list) – List of energy values.
tdos (list) – List of tDOS values.
use_smearing (bool (optional)) – Whether to smear out the density of states. The default value is
False
.unit_x (str (optional)) – Unit of the energy. The default value is
'eV'
.shift_dos (float (optional)) – Shift the density of states by constant value. The default value is
0.0
.
-
plot(data_labels, plot_title=
None
, plot_name='plot.png'
, subplot_assignment=None
)¶ Plot the data sets.
- Parameters:¶
data_labels (list or str) – List of data labels of the data sets that are plotted or in case only one data set is plotted a string.
plot_title (list or str (optional)) – Title of the plots or subplots.
plot_name (str (optional)) – The file name of the plot.
subplot_assignment (list or None (optional)) – Assignment of the data sets to individual subplots.
- Returns:¶
fig (matplotlib.pyplot.figure or plotly.graph_objects.Figure) – Figure object of the plot.
- remove_additional_plot_elements()¶
Remove all added plot elements.
- reset_gridspec()¶
Reset gridspec settings.
- return_data_labels()¶
Return the labels of all data sets.
- Returns:¶
data_labels (list) – List of the labels of all data sets.
- set_reference_cell(reference_cell)¶
Set reference cell.
Just taking the relative positions of the high-symmetry k-points will distort the path if if the unit cell vectors and consequently also the basis vectors of the reciprocal cell have different lengths. This can be accounted for by setting the reference cell and thereby scaling the path segments accordingly. The reference cell needs to be set before importing band structures.
- Parameters:¶
reference_cell (list or np.array) – Nested 3x3 list of the cell vectors.
-
shift_bands(data_label, energy_shift, spin=
'up'
)¶ Shift the bands of one data set.
- Parameters:¶
data_label (str) – Data label of the data set.
energy_shift (float) – Value to shift the bands.
spin (str (optional)) – In case of the spin non-degenerate case the spin (‘up’ or ‘down’).
- shift_bands_and_dos(data_label, shift)[source]¶
Shift band structure and density of states.
TODO: include spin-polarized case.
- Parameters:¶
data_label (str) – Data label of the data set.
shift (float) – Value to shift band structure and density of states.
- class aim2dat.plots.BandStructurePlot(**kwargs)[source]¶
Bases:
aim2dat.plots.base_plot._BasePlot
,aim2dat.plots.base_mixin._HLineMixin
,aim2dat.plots.base_mixin._VLineMixin
,aim2dat.plots.base_band_structure._BaseBandStructure
Plot the band structure of a crystalline structure.
Overview
¶ used backend library to plot the data. Supported values are
"matplotlib"
andAlpha value(s) controlling the opacity of plot elements.
Colors used in the plot.
Hatch value(s) controlling the hatch of plot elements.
Line styles used in the plot (This feature is not supported by all plot
Line widths used in the plot (This feature is not supported by all plot
Marker types used in the plot (This feature is not supported by all plot
List of labels for the ticks on the x-axis.
List of values to set ticks on the x-axis.
List of labels for the ticks on the y-axis.
List of values to set ticks on the y-axis.
List of labels for all data sets.
Set equal aspect ratio of the plot(s).
Shift between box and anchor. The default value is
(1, 1)
.Location of the legend. The default value is
1
.Columns of the legend (only supported for the matplotlib backend).
Sort entries of the legend.
Whether to draw a grid in the plot. The default value is
False
.Length-to-width ratio of the plot given as a tuple of two numbers.
Show colorbar (not supported by all plots).
Whether to draw a grid in the plot. The default value is
False
.Show legend. The default value is
False
.Show plot. The default value is
False
.Path of the folder to store the plot. The default value is
./
.Store plot. The default value is
False
.Custom matplotlib style sheet.
Keyword arguments for the matplotlib
subplots_adjust
function.Align y label of plot. The default value is
False
.Grid spec values.
Vertical spacing between the subplots.
Number of columns. The default value is
1
.Number of rows. The default value is
2
.Use one common colorbar for all subplots.
Merge legend items of all subplots.
Share the x-axis of subplots located in the same column.
Share the y-axis of subplots located in the same row.
Title of the whole figure.
x-label of the whole figure.
y-label of the whole figure.
Tight layout of plot. The default value is
False
.Horizontal spacing between the subplots.
Label of the x-axis. If
None
is given no label will be shown. TheRange of the x-axis. The default value is
None
.Label of the y-axis. If
None
is given no label will be shown. TheRange of the y-axis. The default value is
None
.¶ add_hline
(y, x_min, x_max, color, line_style, scaled, foreground, subplot_assignment, data_label)Add a vertical line to the plot.
add_vline
(x, y_min, y_max, color, line_style, scaled, foreground, subplot_assignment, data_label)Add a vertical line to the plot.
analyse_band
(data_label, band_idx)Calculate the minimum and the maximum energy of the band as well as their k-points.
auto_set_axis_properties
(set_x_label, set_y_label)Whether the axis labels and other axis properties are auto-generated.
calculate_band_gap
(data_label, vbm_band_idx)Calculate the direct and indirect band gap of the band structure.
calculate_energy_diff_at_kpoint
(data_labels, band_idx1, band_idx2, kpoint)Calculate the energy difference between two bands at a certain k-point.
calculate_smallest_direct_energy_diff
(data_label, band_idx1, band_idx2)Calculate the smallest direct energy difference between two bands.
calculate_smallest_energy_diff
(data_label, band_idx1, band_idx2)Calculate the smallest energy difference between two bands.
create_default_gridspec
(nrows, ncols, nplots, heights, widths, center_last_row)Create default grid for multiple plots.
import_band_structure
(data_label, kpoints, bands, path_labels, occupations, unit_y, align_to_vbm)Import a data set.
import_from_aiida_bandsdata
(data_label, bandsdata_node, align_to_vbm)Read band structure from an aiida bandsdata node.
plot
(data_labels, plot_title, plot_name, subplot_assignment)Plot the data sets.
Remove all added plot elements.
Reset gridspec settings.
Return the labels of all data sets.
set_reference_cell
(reference_cell)Set reference cell.
shift_bands
(data_label, energy_shift, spin)Shift the bands of one data set.
- property backend¶
used backend library to plot the data. Supported values are
"matplotlib"
and"plotly"
.- Type:¶
str
- property custom_alpha¶
Alpha value(s) controlling the opacity of plot elements.
- Type:¶
float, list or tuple
- property custom_hatch¶
Hatch value(s) controlling the hatch of plot elements.
- Type:¶
float, list or tuple
- property custom_linestyles¶
Line styles used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_linewidths¶
Line widths used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_markers¶
Marker types used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property legend_bbox_to_anchor¶
Shift between box and anchor. The default value is
(1, 1)
.- Type:¶
tuple or list
- property ratio¶
Length-to-width ratio of the plot given as a tuple of two numbers.
- Type:¶
tuple or list
Use one common colorbar for all subplots.
bool
Merge legend items of all subplots.
bool
Share the x-axis of subplots located in the same column.
bool
Share the y-axis of subplots located in the same row.
bool
- property x_label¶
Label of the x-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
- property y_label¶
Label of the y-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
-
add_hline(y, x_min, x_max, color=
None
, line_style=None
, scaled=False
, foreground=False
, subplot_assignment=None
, data_label=None
)¶ Add a vertical line to the plot.
- Parameters:¶
y (float) – y-position of the line.
x_min (float) – Bottom x-position of the line.
x_max (float) – Top x-position of the line.
color (str or None) – Color of the line.
line_style (str or None) – Line style of the line.
scaled (bool) – Whether the input is given in scaled positions.
foreground (bool) – Whether to plot the line in front of the other elements.
subplot_assignment (list or None) – Assignment of the line to individual subplots.
-
add_vline(x, y_min, y_max, color=
None
, line_style=None
, scaled=False
, foreground=False
, subplot_assignment=None
, data_label=None
)¶ Add a vertical line to the plot.
- Parameters:¶
x (float) – x-position of the line.
y_min (float) – Bottom y-position of the line.
y_max (float) – Top y-position of the line.
color (str or None) – Color of the line.
line_style (str or None) – Line style of the line.
scaled (bool) – Whether the input is given in scaled positions.
foreground (bool) – Whether to plot the line in front of the other elements.
subplot_assignment (list or None) – Assignment of the line to individual subplots.
- analyse_band(data_label, band_idx)¶
Calculate the minimum and the maximum energy of the band as well as their k-points.
- Parameters:¶
data_label (str) – Internal label of the data set.
band_idx (int) – Index of the band that is analysed.
- Returns:¶
band_min (dict) – Dictionary containing the minimum energy and the corresponding k-point.
band_max (dict) – Dictionary containing the maximum energy and the corresponding k-point.
-
auto_set_axis_properties(set_x_label=
True
, set_y_label=True
)¶ Whether the axis labels and other axis properties are auto-generated.
- Parameters:¶
set_x_label (bool) – Set x-axis label automatically.
set_y_label (bool) – Set y-axis label automatically.
-
calculate_band_gap(data_label, vbm_band_idx=
None
)¶ Calculate the direct and indirect band gap of the band structure.
With the parameter
vbm_band_idx
the index of the highest valence band can be passed on.Otherwise, if the occupations are given for the eigenvalues, the highest valence band and lowest conduction band are determined based on the occupation number; an occupation below 0.5 is considered as unoccupied.
If the previous cases do not apply the energy level 0~eV is considered to be within the band gap.
- Parameters:¶
data_label (str) – Internal label of the data set.
vbm_band_idx (int or list (optional)) – Index of the highest occupied band. In case of spin non-degenerate calculations a list of two indices can be given (otherwise the indices for spin-up and spin-down channels are assumed to be the same). If an occupation list is not available this parameter is used to calculate the band gap. Default value is
Ǹone
.
- Returns:¶
band_gap (dict or list) – A dictionary containing information on the size and nature of the band gap, e.g.
{'direct_gap': 2.605352729999999, 'direct_gap_kpoint': [0.0, 0.0, 0.0], 'indirect_gap': 0.6067583699999997, 'vbm_kpoint': [0.0, 0.0, 0.0], 'vbm_energy': 0.0, 'vbm_band_idx': 3, 'cbm_kpoint': [0.41447368, 0.0, 0.41447368], 'cbm_energy': 0.6067583699999997, 'cbm_band_idx': 4}
. In case of spin non-degeneracy the dictionary is given for both spins as a list of dictionaries.
- calculate_energy_diff_at_kpoint(data_labels, band_idx1, band_idx2, kpoint)¶
Calculate the energy difference between two bands at a certain k-point.
- Parameters:¶
data_labels (str or list) – Internal labels of the data sets. In case only one label is given as a string both bands are assumed to be part of the same data set.
band_idx1 (int) – Index of the first band.
band_idx2 (int) – Index of the second band.
kpoint (list) – K-point at which the difference is calculated.
- Returns:¶
energy_diff (float) – Energy difference between the two bands.
- calculate_smallest_direct_energy_diff(data_label, band_idx1, band_idx2)¶
Calculate the smallest direct energy difference between two bands.
- Parameters:¶
data_label (str) – Internal label of the data set.
band_idx1 (int) – Index of the first band.
band_idx2 (int) – Index of the second band.
- Returns:¶
energy_diff (dict or list) – Dictionary containing the energy difference and the k-points of the band maximum and band minimum, e.g.:
{'energy': 2.605352729999999, 'kpoint': [0.0, 0.0, 0.0]}
. In case of spin non-degeneracy the dictionary is given for both spins as a list of dictionaries.
- calculate_smallest_energy_diff(data_label, band_idx1, band_idx2)¶
Calculate the smallest energy difference between two bands.
- Parameters:¶
data_label (str) – Internal label of the data set.
band_idx1 (int) – Index of the first band.
band_idx2 (int) – Index of the second band.
- Returns:¶
energy_diff (dict or list) – Dictionary containing the energy difference and the k-points of the band maximum and band minimum, e.g.:
{'energy': 3.7729889100000005, 'kpoint_min': [0.5, 0.25, 0.75], 'kpoint_max' : [0.5, 0.25, 0.75]}
. In case of spin non-degeneracy the dictionary is given for both spins as a list of dictionaries.
-
create_default_gridspec(nrows, ncols, nplots, heights=
1
, widths=1
, center_last_row=True
)¶ Create default grid for multiple plots.
- Parameters:¶
nrows (Int) – Number of rows.
ncols (int) – Number columns.
nplots (int) – Number of subplots.
heights (int (optional)) – Height of subplots.
widths (int (optional)) – Width of subplots.
center_last_row (bool (optional)) – Center the plots of the last row.
-
import_band_structure(data_label, kpoints, bands, path_labels=
None
, occupations=None
, unit_y='eV'
, align_to_vbm=False
)¶ Import a data set.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
kpoints (list) – List of k-points.
bands (list) – List of eigenvalues (nkpoints x neigenvalues or nspins x nkpoints x neigenvalues).
path_labels (list (optional)) – List of path labels.
occupations (list (optional)) – List of occupations.
unit_y (str (optional)) – Unit to be used in the y-label.
align_to_vbm (bool) – Whether the bands should be aligned to the valence band maximum. Works only if occupation numbers are given. A band is defined as unoccupied if the number of electrons is below 0.5.
-
import_from_aiida_bandsdata(data_label, bandsdata_node, align_to_vbm=
False
)¶ Read band structure from an aiida bandsdata node.
- Parameters:¶
data_label (str) – Internal label of the data set.
bandsdata_node (aiida.bands, int or str) – Data node containing the band structure or its primary key or uuid.
align_to_vbm (bool) – Whether the bands should be aligned to the valence band maximum. Works only if occupation numbers are given. A band is defined as unoccupied if the number of electrons is below 0.5. The default value is
False
.
-
plot(data_labels, plot_title=
None
, plot_name='plot.png'
, subplot_assignment=None
)¶ Plot the data sets.
- Parameters:¶
data_labels (list or str) – List of data labels of the data sets that are plotted or in case only one data set is plotted a string.
plot_title (list or str (optional)) – Title of the plots or subplots.
plot_name (str (optional)) – The file name of the plot.
subplot_assignment (list or None (optional)) – Assignment of the data sets to individual subplots.
- Returns:¶
fig (matplotlib.pyplot.figure or plotly.graph_objects.Figure) – Figure object of the plot.
- remove_additional_plot_elements()¶
Remove all added plot elements.
- reset_gridspec()¶
Reset gridspec settings.
- return_data_labels()¶
Return the labels of all data sets.
- Returns:¶
data_labels (list) – List of the labels of all data sets.
- set_reference_cell(reference_cell)¶
Set reference cell.
Just taking the relative positions of the high-symmetry k-points will distort the path if if the unit cell vectors and consequently also the basis vectors of the reciprocal cell have different lengths. This can be accounted for by setting the reference cell and thereby scaling the path segments accordingly. The reference cell needs to be set before importing band structures.
- Parameters:¶
reference_cell (list or np.array) – Nested 3x3 list of the cell vectors.
-
class aim2dat.plots.DOSPlot(ratio=
(10, 4)
, pdos_plot_type='line'
, tdos_plot_type='fill'
, dos_comp_threshold=0.47
, smearing_method='gaussian'
, smearing_delta=0.005
, smearing_sigma=5.0
, sum_pdos=False
, per_atom=False
, **kwargs)[source]¶ Bases:
aim2dat.plots.base_plot._BasePlot
,aim2dat.plots.base_mixin._VLineMixin
,aim2dat.plots.base_dos._BaseDensityOfStates
Class to plot the density of states.
- Variables:¶
- dos_comp_threshold : float¶
Threshold to compare the density of states if
detect_equivalent_kinds
is set toTrue
when importing projected density of states data sets.- sum_pdos : bool¶
Whether to sum all pDOS data sets to obtain a tDOS.
- per_atom : bool¶
Normalize all density of states data sets to the numer of atoms.
Overview
¶ used backend library to plot the data. Supported values are
"matplotlib"
andAlpha value(s) controlling the opacity of plot elements.
Colors used in the plot.
Hatch value(s) controlling the hatch of plot elements.
Line styles used in the plot (This feature is not supported by all plot
Line widths used in the plot (This feature is not supported by all plot
Marker types used in the plot (This feature is not supported by all plot
List of labels for the ticks on the x-axis.
List of values to set ticks on the x-axis.
List of labels for the ticks on the y-axis.
List of values to set ticks on the y-axis.
List of labels for all data sets.
Set equal aspect ratio of the plot(s).
Shift between box and anchor. The default value is
(1, 1)
.Location of the legend. The default value is
1
.Columns of the legend (only supported for the matplotlib backend).
Sort entries of the legend.
plot type of the pDOS data sets, supported options are
'line'
,'fill'
Whether to draw a grid in the plot. The default value is
False
.Length-to-width ratio of the plot given as a tuple of two numbers.
Show colorbar (not supported by all plots).
Whether to draw a grid in the plot. The default value is
False
.Show legend. The default value is
False
.Show plot. The default value is
False
.Spacing between two values. If set to
None
the original function isMethod used to smear out the functions. Supported options are
'gaussian'
andSigma value of the smearing distribution.
Path of the folder to store the plot. The default value is
./
.Store plot. The default value is
False
.Custom matplotlib style sheet.
Keyword arguments for the matplotlib
subplots_adjust
function.Align y label of plot. The default value is
False
.Grid spec values.
Vertical spacing between the subplots.
Number of columns. The default value is
1
.Number of rows. The default value is
2
.Use one common colorbar for all subplots.
Merge legend items of all subplots.
Share the x-axis of subplots located in the same column.
Share the y-axis of subplots located in the same row.
Title of the whole figure.
x-label of the whole figure.
y-label of the whole figure.
Tight layout of plot. The default value is
False
.Horizontal spacing between the subplots.
plot type of the tDOS data sets, supported options are
'line'
,'fill'
Label of the x-axis. If
None
is given no label will be shown. TheRange of the x-axis. The default value is
None
.Label of the y-axis. If
None
is given no label will be shown. TheRange of the y-axis. The default value is
None
.¶ add_vline
(x, y_min, y_max, color, line_style, scaled, foreground, subplot_assignment, data_label)Add a vertical line to the plot.
auto_set_axis_properties
(set_x_label, set_y_label)Whether the axis labels and other axis properties are auto-generated.
create_default_gridspec
(nrows, ncols, nplots, heights, widths, center_last_row)Create default grid for multiple plots.
import_from_aiida_xydata
(data_label, pdosdata, shift_dos, use_smearing, sum_kinds, sum_principal_qn, sum_azimuth_qn, sum_magnetic_qn, detect_equivalent_kinds, custom_kind_dict)Read projected density of states from an AiiDA xy-data node.
import_projected_dos
(data_label, energy, pdos, unit_x, shift_dos, use_smearing, sum_kinds, sum_principal_qn, sum_azimuth_qn, sum_magnetic_qn, detect_equivalent_kinds, custom_kind_dict)Import projected density of states.
import_total_dos
(data_label, energy, tdos, use_smearing, unit_x, shift_dos)Import total density of states.
plot
(data_labels, plot_title, plot_name, subplot_assignment)Plot the data sets.
Remove all added plot elements.
Reset gridspec settings.
Return the labels of all data sets.
shift_dos
(data_label, shift)Shift density of states.
- property backend¶
used backend library to plot the data. Supported values are
"matplotlib"
and"plotly"
.- Type:¶
str
- property custom_alpha¶
Alpha value(s) controlling the opacity of plot elements.
- Type:¶
float, list or tuple
- property custom_hatch¶
Hatch value(s) controlling the hatch of plot elements.
- Type:¶
float, list or tuple
- property custom_linestyles¶
Line styles used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_linewidths¶
Line widths used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_markers¶
Marker types used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property legend_bbox_to_anchor¶
Shift between box and anchor. The default value is
(1, 1)
.- Type:¶
tuple or list
- property pdos_plot_type¶
plot type of the pDOS data sets, supported options are
'line'
,'fill'
and'linefill'
.- Type:¶
str
- property ratio¶
Length-to-width ratio of the plot given as a tuple of two numbers.
- Type:¶
tuple or list
- property smearing_delta¶
Spacing between two values. If set to
None
the original function is used.- Type:¶
float or None
- property smearing_method¶
Method used to smear out the functions. Supported options are
'gaussian'
and'lorentzian'
.- Type:¶
str
Use one common colorbar for all subplots.
bool
Merge legend items of all subplots.
bool
Share the x-axis of subplots located in the same column.
bool
Share the y-axis of subplots located in the same row.
bool
- property tdos_plot_type¶
plot type of the tDOS data sets, supported options are
'line'
,'fill'
and'linefill'
.- Type:¶
str
- property x_label¶
Label of the x-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
- property y_label¶
Label of the y-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
-
add_vline(x, y_min, y_max, color=
None
, line_style=None
, scaled=False
, foreground=False
, subplot_assignment=None
, data_label=None
)¶ Add a vertical line to the plot.
- Parameters:¶
x (float) – x-position of the line.
y_min (float) – Bottom y-position of the line.
y_max (float) – Top y-position of the line.
color (str or None) – Color of the line.
line_style (str or None) – Line style of the line.
scaled (bool) – Whether the input is given in scaled positions.
foreground (bool) – Whether to plot the line in front of the other elements.
subplot_assignment (list or None) – Assignment of the line to individual subplots.
-
auto_set_axis_properties(set_x_label=
True
, set_y_label=True
)¶ Whether the axis labels and other axis properties are auto-generated.
- Parameters:¶
set_x_label (bool) – Set x-axis label automatically.
set_y_label (bool) – Set y-axis label automatically.
-
create_default_gridspec(nrows, ncols, nplots, heights=
1
, widths=1
, center_last_row=True
)¶ Create default grid for multiple plots.
- Parameters:¶
nrows (Int) – Number of rows.
ncols (int) – Number columns.
nplots (int) – Number of subplots.
heights (int (optional)) – Height of subplots.
widths (int (optional)) – Width of subplots.
center_last_row (bool (optional)) – Center the plots of the last row.
-
import_from_aiida_xydata(data_label, pdosdata, shift_dos=
0.0
, use_smearing=False
, sum_kinds=False
, sum_principal_qn=True
, sum_azimuth_qn=False
, sum_magnetic_qn=True
, detect_equivalent_kinds=False
, custom_kind_dict=None
)¶ Read projected density of states from an AiiDA xy-data node.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
pdosdata (aiida.orm.array.xy or dict) – AiiDA data node or dictionary of AiiDA data nodes for each kind.
shift_dos (float) – Shift the density of states by constant value. The default value is
0.0
.use_smearing (bool (optional)) – Whether to smear out the density of states. The default value is
False
.sum_kinds (bool (optional)) – Whether to sum different kinds of the same element. The default value is
False
.sum_principal_qn (bool (optional)) – Whether to sum up the principal quantum numbers. The default value is
True
.sum_azimuth_qn (bool (optional)) – Whether to sum up the azimuth quantum numbers.
sum_magnetic_qn (bool (optional)) – Whether to sum up the magnetic quantum numbers. The default value is
True
.detect_equivalent_kinds (bool (optional)) – Tries to identify equivalent sites by calculating the difference of the projected densities at each energy value. The default value is
False
.custom_kind_dict (dict or None (optional)) – Group the projected densities and put custom labels, e.g.
{"label_1": (0, 1, 2), "label_2": (3, 4, 5)}
.
-
import_projected_dos(data_label, energy, pdos, unit_x=
'eV'
, shift_dos=0.0
, use_smearing=False
, sum_kinds=False
, sum_principal_qn=True
, sum_azimuth_qn=False
, sum_magnetic_qn=True
, detect_equivalent_kinds=False
, custom_kind_dict=None
)¶ Import projected density of states.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
energy (list) – List of energy values.
pdos (list) – List of projected density of states data. The list should consist of dictionaries with the orbital labels as keys and the pdos as values. Additionallly, the element and/or kind of the atom should be included.
unit_x (str (optional)) – Unit of the energy. The default value is
'eV'
.shift_dos (float (optional)) – Shift the density of states by constant value. The default value is
0.0
.use_smearing (bool (optional)) – Whether to smear out the density of states. The default value is
False
.sum_kinds (bool (optional)) – Whether to sum different kinds of the same element. The default value is
False
.sum_principal_qn (bool (optional)) – Whether to sum up the principal quantum numbers. The default value is
True
.sum_azimuth_qn (bool (optional)) – Whether to sum up the azimuth quantum numbers.
sum_magnetic_qn (bool (optional)) – Whether to sum up the magnetic quantum numbers. The default value is
True
.detect_equivalent_kinds (bool (optional)) – Tries to identify equivalent sites by calculating the difference of the projected densities at each energy value. The default value is
False
.custom_kind_dict (dict or None (optional)) – Group the projected densities and put custom labels, e.g.
{"label_1": (0, 1, 2), "label_2": (3, 4, 5)}
.
-
import_total_dos(data_label, energy, tdos, use_smearing=
False
, unit_x='eV'
, shift_dos=0.0
)¶ Import total density of states.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
energy (list) – List of energy values.
tdos (list) – List of tDOS values.
use_smearing (bool (optional)) – Whether to smear out the density of states. The default value is
False
.unit_x (str (optional)) – Unit of the energy. The default value is
'eV'
.shift_dos (float (optional)) – Shift the density of states by constant value. The default value is
0.0
.
-
plot(data_labels, plot_title=
None
, plot_name='plot.png'
, subplot_assignment=None
)¶ Plot the data sets.
- Parameters:¶
data_labels (list or str) – List of data labels of the data sets that are plotted or in case only one data set is plotted a string.
plot_title (list or str (optional)) – Title of the plots or subplots.
plot_name (str (optional)) – The file name of the plot.
subplot_assignment (list or None (optional)) – Assignment of the data sets to individual subplots.
- Returns:¶
fig (matplotlib.pyplot.figure or plotly.graph_objects.Figure) – Figure object of the plot.
- remove_additional_plot_elements()¶
Remove all added plot elements.
- reset_gridspec()¶
Reset gridspec settings.
-
class aim2dat.plots.PartialChargesPlot(custom_linestyles=
['solid']
, pc_plot_type='scatter'
, pc_plot_order=[]
, **kwargs)[source]¶ Bases:
aim2dat.plots.base_plot._BasePlot
Plot the partial charges.
Overview
¶ used backend library to plot the data. Supported values are
"matplotlib"
andAlpha value(s) controlling the opacity of plot elements.
Colors used in the plot.
Hatch value(s) controlling the hatch of plot elements.
Line styles used in the plot (This feature is not supported by all plot
Line widths used in the plot (This feature is not supported by all plot
Marker types used in the plot (This feature is not supported by all plot
List of labels for the ticks on the x-axis.
List of values to set ticks on the x-axis.
List of labels for the ticks on the y-axis.
List of values to set ticks on the y-axis.
List of labels for all data sets.
Set equal aspect ratio of the plot(s).
Shift between box and anchor. The default value is
(1, 1)
.Location of the legend. The default value is
1
.Columns of the legend (only supported for the matplotlib backend).
Sort entries of the legend.
List of plot assignments to order the plotted data.
plot type of the partial charge data sets,
Whether to draw a grid in the plot. The default value is
False
.Length-to-width ratio of the plot given as a tuple of two numbers.
Show colorbar (not supported by all plots).
Whether to draw a grid in the plot. The default value is
False
.Show legend. The default value is
False
.Show plot. The default value is
False
.Path of the folder to store the plot. The default value is
./
.Store plot. The default value is
False
.Custom matplotlib style sheet.
Keyword arguments for the matplotlib
subplots_adjust
function.Align y label of plot. The default value is
False
.Grid spec values.
Vertical spacing between the subplots.
Number of columns. The default value is
1
.Number of rows. The default value is
2
.Use one common colorbar for all subplots.
Merge legend items of all subplots.
Share the x-axis of subplots located in the same column.
Share the y-axis of subplots located in the same row.
Title of the whole figure.
x-label of the whole figure.
y-label of the whole figure.
Tight layout of plot. The default value is
False
.Horizontal spacing between the subplots.
Label of the x-axis. If
None
is given no label will be shown. TheRange of the x-axis. The default value is
None
.Label of the y-axis. If
None
is given no label will be shown. TheRange of the y-axis. The default value is
None
.¶ auto_set_axis_properties
(set_x_label, set_y_label)Whether the axis labels and other axis properties are auto-generated.
create_default_gridspec
(nrows, ncols, nplots, heights, widths, center_last_row)Create default grid for multiple plots.
import_from_aiida_list
(data_label, pcdata, plot_label, x_label, custom_kind_dict)Import partial charges.
import_partial_charges
(data_label, partial_charges, valence_electrons, plot_label, x_label, custom_kind_dict)Import partial charges.
plot
(data_labels, plot_title, plot_name, subplot_assignment)Plot the data sets.
Reset gridspec settings.
Return the labels of all data sets.
- property backend¶
used backend library to plot the data. Supported values are
"matplotlib"
and"plotly"
.- Type:¶
str
- property custom_alpha¶
Alpha value(s) controlling the opacity of plot elements.
- Type:¶
float, list or tuple
- property custom_hatch¶
Hatch value(s) controlling the hatch of plot elements.
- Type:¶
float, list or tuple
- property custom_linestyles¶
Line styles used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_linewidths¶
Line widths used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_markers¶
Marker types used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property legend_bbox_to_anchor¶
Shift between box and anchor. The default value is
(1, 1)
.- Type:¶
tuple or list
- property pc_plot_type¶
plot type of the partial charge data sets, supported options are
'scatter'
,'bar'
.- Type:¶
str
- property ratio¶
Length-to-width ratio of the plot given as a tuple of two numbers.
- Type:¶
tuple or list
Use one common colorbar for all subplots.
bool
Merge legend items of all subplots.
bool
Share the x-axis of subplots located in the same column.
bool
Share the y-axis of subplots located in the same row.
bool
- property x_label¶
Label of the x-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
- property y_label¶
Label of the y-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
-
auto_set_axis_properties(set_x_label=
True
, set_y_label=True
)¶ Whether the axis labels and other axis properties are auto-generated.
- Parameters:¶
set_x_label (bool) – Set x-axis label automatically.
set_y_label (bool) – Set y-axis label automatically.
-
create_default_gridspec(nrows, ncols, nplots, heights=
1
, widths=1
, center_last_row=True
)¶ Create default grid for multiple plots.
- Parameters:¶
nrows (Int) – Number of rows.
ncols (int) – Number columns.
nplots (int) – Number of subplots.
heights (int (optional)) – Height of subplots.
widths (int (optional)) – Width of subplots.
center_last_row (bool (optional)) – Center the plots of the last row.
-
import_from_aiida_list(data_label, pcdata, plot_label, x_label, custom_kind_dict=
None
)[source]¶ Import partial charges.
- Parameters:¶
data_label (str) – Internal label of the data set.
pcdata (aiida.orm.list) – AiiDA data node containing the partial charges as list of dictionaries.
plot_label (str) – Label in legend on how to plot data.
x_label (str) – Label on x axes to sort data.
custom_kind_dict (dict or None (optional)) – Group the partial charges by taking the average value and put custom labels, e.g.
{"label_1": [0, 1, 2], "label_2": [[3, 4], [5]]}
. In case a nested list is given as a value the sum of the average value(s) is calculated.
-
import_partial_charges(data_label, partial_charges, valence_electrons, plot_label, x_label, custom_kind_dict=
None
)[source]¶ Import partial charges.
- Parameters:¶
data_label (str) – Internal label of the data set.
partial_charges (list of dict) – List of dict containing elements and populations, e.g.
[{"element": "H", "population": 0.9}, {"element": "O", "population": 7.4}]
valence_electrons (dict) – Valence electrons used for each element to calculate partial charges.
plot_label (str) – Label in legend on how to plot data.
x_label (str) – Label on x axes to sort data.
custom_kind_dict (dict or None (optional)) – Group the partial charges by taking the average value and put custom labels, e.g.
{"label_1": [0, 1, 2], "label_2": [[3, 4], [5]]}
. In case a nested list is given as a value the sum of the average value(s) is calculated.
-
plot(data_labels, plot_title=
None
, plot_name='plot.png'
, subplot_assignment=None
)¶ Plot the data sets.
- Parameters:¶
data_labels (list or str) – List of data labels of the data sets that are plotted or in case only one data set is plotted a string.
plot_title (list or str (optional)) – Title of the plots or subplots.
plot_name (str (optional)) – The file name of the plot.
subplot_assignment (list or None (optional)) – Assignment of the data sets to individual subplots.
- Returns:¶
fig (matplotlib.pyplot.figure or plotly.graph_objects.Figure) – Figure object of the plot.
- reset_gridspec()¶
Reset gridspec settings.
-
class aim2dat.plots.PartialRDFPlot(custom_linestyles=
['solid', 'dashed', 'dotted', 'dashdot']
, **kwargs)[source]¶ Bases:
aim2dat.plots.base_plot._BasePlot
Plot the partial radial distribution function.
Overview
¶ used backend library to plot the data. Supported values are
"matplotlib"
andAlpha value(s) controlling the opacity of plot elements.
Colors used in the plot.
Hatch value(s) controlling the hatch of plot elements.
Line styles used in the plot (This feature is not supported by all plot
Line widths used in the plot (This feature is not supported by all plot
Marker types used in the plot (This feature is not supported by all plot
List of labels for the ticks on the x-axis.
List of values to set ticks on the x-axis.
List of labels for the ticks on the y-axis.
List of values to set ticks on the y-axis.
List of labels for all data sets.
Set equal aspect ratio of the plot(s).
Shift between box and anchor. The default value is
(1, 1)
.Location of the legend. The default value is
1
.Columns of the legend (only supported for the matplotlib backend).
Sort entries of the legend.
Whether to draw a grid in the plot. The default value is
False
.Length-to-width ratio of the plot given as a tuple of two numbers.
Show colorbar (not supported by all plots).
Whether to draw a grid in the plot. The default value is
False
.Show legend. The default value is
False
.Show plot. The default value is
False
.Path of the folder to store the plot. The default value is
./
.Store plot. The default value is
False
.Custom matplotlib style sheet.
Keyword arguments for the matplotlib
subplots_adjust
function.Align y label of plot. The default value is
False
.Grid spec values.
Vertical spacing between the subplots.
Number of columns. The default value is
1
.Number of rows. The default value is
2
.Use one common colorbar for all subplots.
Merge legend items of all subplots.
Share the x-axis of subplots located in the same column.
Share the y-axis of subplots located in the same row.
Title of the whole figure.
x-label of the whole figure.
y-label of the whole figure.
Tight layout of plot. The default value is
False
.Horizontal spacing between the subplots.
Label of the x-axis. If
None
is given no label will be shown. TheRange of the x-axis. The default value is
None
.Set unit of the x coordinate.
Label of the y-axis. If
None
is given no label will be shown. TheRange of the y-axis. The default value is
None
.¶ auto_set_axis_properties
(set_x_label, set_y_label)Whether the axis labels and other axis properties are auto-generated.
create_default_gridspec
(nrows, ncols, nplots, heights, widths, center_last_row)Create default grid for multiple plots.
import_ffingerprint
(data_label, bins, fingerprints, x_unit)Import F-Fingerprint functions.
plot
(data_labels, plot_title, plot_name, subplot_assignment)Plot the data sets.
Reset gridspec settings.
Return the labels of all data sets.
- property backend¶
used backend library to plot the data. Supported values are
"matplotlib"
and"plotly"
.- Type:¶
str
- property custom_alpha¶
Alpha value(s) controlling the opacity of plot elements.
- Type:¶
float, list or tuple
- property custom_hatch¶
Hatch value(s) controlling the hatch of plot elements.
- Type:¶
float, list or tuple
- property custom_linestyles¶
Line styles used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_linewidths¶
Line widths used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_markers¶
Marker types used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property legend_bbox_to_anchor¶
Shift between box and anchor. The default value is
(1, 1)
.- Type:¶
tuple or list
- property ratio¶
Length-to-width ratio of the plot given as a tuple of two numbers.
- Type:¶
tuple or list
Use one common colorbar for all subplots.
bool
Merge legend items of all subplots.
bool
Share the x-axis of subplots located in the same column.
bool
Share the y-axis of subplots located in the same row.
bool
- property x_label¶
Label of the x-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
- property x_unit¶
Set unit of the x coordinate.
- property y_label¶
Label of the y-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
-
auto_set_axis_properties(set_x_label=
True
, set_y_label=True
)¶ Whether the axis labels and other axis properties are auto-generated.
- Parameters:¶
set_x_label (bool) – Set x-axis label automatically.
set_y_label (bool) – Set y-axis label automatically.
-
create_default_gridspec(nrows, ncols, nplots, heights=
1
, widths=1
, center_last_row=True
)¶ Create default grid for multiple plots.
- Parameters:¶
nrows (Int) – Number of rows.
ncols (int) – Number columns.
nplots (int) – Number of subplots.
heights (int (optional)) – Height of subplots.
widths (int (optional)) – Width of subplots.
center_last_row (bool (optional)) – Center the plots of the last row.
-
import_ffingerprint(data_label, bins, fingerprints, x_unit=
None
)[source]¶ Import F-Fingerprint functions.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
bins (list) – Bins of the distance.
fingerprints (dict) – Dictionary with the keys being the element pairs as tuples and the fingerprint functions as values.
x_unit (str or None (optional)) – Unit of the x-axis.
-
plot(data_labels, plot_title=
None
, plot_name='plot.png'
, subplot_assignment=None
)¶ Plot the data sets.
- Parameters:¶
data_labels (list or str) – List of data labels of the data sets that are plotted or in case only one data set is plotted a string.
plot_title (list or str (optional)) – Title of the plots or subplots.
plot_name (str (optional)) – The file name of the plot.
subplot_assignment (list or None (optional)) – Assignment of the data sets to individual subplots.
- Returns:¶
fig (matplotlib.pyplot.figure or plotly.graph_objects.Figure) – Figure object of the plot.
- reset_gridspec()¶
Reset gridspec settings.
-
class aim2dat.plots.PhasePlot(plot_type=
'scatter'
, plot_property='formation_energy'
, show_crystal_system=False
, show_convex_hull=True
, show_lower_hull=False
, show_upper_hull=False
, top_labels=[]
, hist_bin_size=0.1
, **kwargs)[source]¶ Bases:
aim2dat.plots.base_plot._BasePlot
Plot the formation energy of binary and ternary material systems.
Overview
¶ used backend library to plot the data. Supported values are
"matplotlib"
andAlpha value(s) controlling the opacity of plot elements.
Colors used in the plot.
Hatch value(s) controlling the hatch of plot elements.
Line styles used in the plot (This feature is not supported by all plot
Line widths used in the plot (This feature is not supported by all plot
Marker types used in the plot (This feature is not supported by all plot
List of labels for the ticks on the x-axis.
List of values to set ticks on the x-axis.
List of labels for the ticks on the y-axis.
List of values to set ticks on the y-axis.
List of labels for all data sets.
List of elements that are included in the plot. If set to
None
all elementsSet equal aspect ratio of the plot(s).
Shift between box and anchor. The default value is
(1, 1)
.Location of the legend. The default value is
1
.Columns of the legend (only supported for the matplotlib backend).
Sort entries of the legend.
Whether to draw a grid in the plot. The default value is
False
.'formation_energy'
,'stability'
,Length-to-width ratio of the plot given as a tuple of two numbers.
Show colorbar (not supported by all plots).
Show crystal system of the phases.
Whether to draw a grid in the plot. The default value is
False
.Show legend. The default value is
False
.Show plot. The default value is
False
.Path of the folder to store the plot. The default value is
./
.Store plot. The default value is
False
.Custom matplotlib style sheet.
Keyword arguments for the matplotlib
subplots_adjust
function.Align y label of plot. The default value is
False
.Grid spec values.
Vertical spacing between the subplots.
Number of columns. The default value is
1
.Number of rows. The default value is
2
.Use one common colorbar for all subplots.
Merge legend items of all subplots.
Share the x-axis of subplots located in the same column.
Share the y-axis of subplots located in the same row.
Title of the whole figure.
x-label of the whole figure.
y-label of the whole figure.
Tight layout of plot. The default value is
False
.Horizontal spacing between the subplots.
Chemical formulas that are shown as labels in the plot.
Label of the x-axis. If
None
is given no label will be shown. TheRange of the x-axis. The default value is
None
.Label of the y-axis. If
None
is given no label will be shown. TheRange of the y-axis. The default value is
None
.¶ add_data_point
(data_label, formula, formation_energy, stability, unit, space_group, attributes)Add datapoint to the dataset.
auto_set_axis_properties
(set_x_label, set_y_label)Whether the axis labels and other axis properties are auto-generated.
create_default_gridspec
(nrows, ncols, nplots, heights, widths, center_last_row)Create default grid for multiple plots.
import_from_pandas_df
(data_label, data_frame, structure_column)Import data from pandas data frame.
import_from_structure_collection
(data_label, structure_collection)Import data from a StructureCollection object.
plot
(data_labels, plot_title, plot_name, subplot_assignment)Plot the data sets.
Reset gridspec settings.
Return the labels of all data sets.
- property backend¶
used backend library to plot the data. Supported values are
"matplotlib"
and"plotly"
.- Type:¶
str
- property custom_alpha¶
Alpha value(s) controlling the opacity of plot elements.
- Type:¶
float, list or tuple
- property custom_hatch¶
Hatch value(s) controlling the hatch of plot elements.
- Type:¶
float, list or tuple
- property custom_linestyles¶
Line styles used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_linewidths¶
Line widths used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_markers¶
Marker types used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property elements¶
List of elements that are included in the plot. If set to
None
all elements are included.- Type:¶
list
- property legend_bbox_to_anchor¶
Shift between box and anchor. The default value is
(1, 1)
.- Type:¶
tuple or list
- property plot_type¶
'formation_energy'
,'stability'
,'band_gap'
,'direct_band_gap'
and'numbers'
.- Type:¶
Specify plot type. Supported options are
- property ratio¶
Length-to-width ratio of the plot given as a tuple of two numbers.
- Type:¶
tuple or list
- property show_crystal_system¶
Show crystal system of the phases.
Use one common colorbar for all subplots.
bool
Merge legend items of all subplots.
bool
Share the x-axis of subplots located in the same column.
bool
Share the y-axis of subplots located in the same row.
bool
- property top_labels¶
Chemical formulas that are shown as labels in the plot.
- Type:¶
list or str or dict
- property x_label¶
Label of the x-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
- property y_label¶
Label of the y-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
-
add_data_point(data_label, formula, formation_energy=
None
, stability=None
, unit=None
, space_group=None
, attributes=None
)[source]¶ Add datapoint to the dataset.
If the
data_label
does not exist, a new data set with labeldata_label
is created.- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
formula (dict) – Chemical formula of the material, e.g.
{'Cs': 1, 'Sb': 2}
.formation_energy (float (optional)) – Formation energy of the material.
stability (float (optional)) – Stability of the material.
unit (str (optional)) – Unit of the formation energy and stability.
space_group (str or int (optional)) – Space group of the material, as symbol or number. The default value is
None
.attributes (dict (optional)) – Additional attributes of the material that can be plotted.
-
auto_set_axis_properties(set_x_label=
True
, set_y_label=True
)¶ Whether the axis labels and other axis properties are auto-generated.
- Parameters:¶
set_x_label (bool) – Set x-axis label automatically.
set_y_label (bool) – Set y-axis label automatically.
-
create_default_gridspec(nrows, ncols, nplots, heights=
1
, widths=1
, center_last_row=True
)¶ Create default grid for multiple plots.
- Parameters:¶
nrows (Int) – Number of rows.
ncols (int) – Number columns.
nplots (int) – Number of subplots.
heights (int (optional)) – Height of subplots.
widths (int (optional)) – Width of subplots.
center_last_row (bool (optional)) – Center the plots of the last row.
-
import_from_pandas_df(data_label, data_frame, structure_column=
'optimized_structure'
)[source]¶ Import data from pandas data frame.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
data_frame (pandas.DataFrame) – Pandas data frame containing the total energy or formation energy and the structural details.
structure_column (str (optional)) – Column containing AiiDA structure nodes used to determine structural and compositional properties. The default value is
'optimized_structure'
.
- import_from_structure_collection(data_label, structure_collection)[source]¶
Import data from a StructureCollection object.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
structure_collection (aim2dat.strct.StructureCollection) – Instance of StructureCollection containing all structures.
-
plot(data_labels, plot_title=
None
, plot_name='plot.png'
, subplot_assignment=None
)¶ Plot the data sets.
- Parameters:¶
data_labels (list or str) – List of data labels of the data sets that are plotted or in case only one data set is plotted a string.
plot_title (list or str (optional)) – Title of the plots or subplots.
plot_name (str (optional)) – The file name of the plot.
subplot_assignment (list or None (optional)) – Assignment of the data sets to individual subplots.
- Returns:¶
fig (matplotlib.pyplot.figure or plotly.graph_objects.Figure) – Figure object of the plot.
- reset_gridspec()¶
Reset gridspec settings.
-
class aim2dat.plots.PlanarFieldPlot(show_x_label=
True
, show_y_label=True
, **kwargs)[source]¶ Bases:
aim2dat.plots.base_plot._BasePlot
Plot scalar planar fields.
Overview
¶ used backend library to plot the data. Supported values are
"matplotlib"
andSet unit of the two coordinates.
Alpha value(s) controlling the opacity of plot elements.
Colors used in the plot.
Hatch value(s) controlling the hatch of plot elements.
Line styles used in the plot (This feature is not supported by all plot
Line widths used in the plot (This feature is not supported by all plot
Marker types used in the plot (This feature is not supported by all plot
List of labels for the ticks on the x-axis.
List of values to set ticks on the x-axis.
List of labels for the ticks on the y-axis.
List of values to set ticks on the y-axis.
List of labels for all data sets.
Set equal aspect ratio of the plot(s).
Shift between box and anchor. The default value is
(1, 1)
.Location of the legend. The default value is
1
.Columns of the legend (only supported for the matplotlib backend).
Sort entries of the legend.
Set norm of the z-values for matplotlib.
Whether to draw a grid in the plot. The default value is
False
.Set plot-type.
Length-to-width ratio of the plot given as a tuple of two numbers.
Show colorbar (not supported by all plots).
Whether to draw a grid in the plot. The default value is
False
.Show legend. The default value is
False
.Show plot. The default value is
False
.Path of the folder to store the plot. The default value is
./
.Store plot. The default value is
False
.Custom matplotlib style sheet.
Keyword arguments for the matplotlib
subplots_adjust
function.Align y label of plot. The default value is
False
.Grid spec values.
Vertical spacing between the subplots.
Number of columns. The default value is
1
.Number of rows. The default value is
2
.Use one common colorbar for all subplots.
Merge legend items of all subplots.
Share the x-axis of subplots located in the same column.
Share the y-axis of subplots located in the same row.
Title of the whole figure.
x-label of the whole figure.
y-label of the whole figure.
Tight layout of plot. The default value is
False
.Horizontal spacing between the subplots.
Set unit of the z-values.
Label of the x-axis. If
None
is given no label will be shown. TheRange of the x-axis. The default value is
None
.Label of the y-axis. If
None
is given no label will be shown. TheRange of the y-axis. The default value is
None
.¶ auto_set_axis_properties
(set_x_label, set_y_label)Whether the axis labels and other axis properties are auto-generated.
create_default_gridspec
(nrows, ncols, nplots, heights, widths, center_last_row)Create default grid for multiple plots.
import_field
(data_label, coordinates, values, flip_lr, flip_ud, coordinates_unit, values_unit, text_labels)Import field.
import_from_aiida_arraydata
(data_label, planedata, flip_lr, flip_ud, values_unit, text_labels)Import from aiida array data.
plot
(data_labels, plot_title, plot_name, subplot_assignment)Plot the data sets.
Reset gridspec settings.
Return the labels of all data sets.
- property backend¶
used backend library to plot the data. Supported values are
"matplotlib"
and"plotly"
.- Type:¶
str
- property coordinates_unit¶
Set unit of the two coordinates.
- property custom_alpha¶
Alpha value(s) controlling the opacity of plot elements.
- Type:¶
float, list or tuple
- property custom_hatch¶
Hatch value(s) controlling the hatch of plot elements.
- Type:¶
float, list or tuple
- property custom_linestyles¶
Line styles used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_linewidths¶
Line widths used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_markers¶
Marker types used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property legend_bbox_to_anchor¶
Shift between box and anchor. The default value is
(1, 1)
.- Type:¶
tuple or list
- property norm¶
Set norm of the z-values for matplotlib.
- property plot_type¶
Set plot-type.
- property ratio¶
Length-to-width ratio of the plot given as a tuple of two numbers.
- Type:¶
tuple or list
Use one common colorbar for all subplots.
bool
Merge legend items of all subplots.
bool
Share the x-axis of subplots located in the same column.
bool
Share the y-axis of subplots located in the same row.
bool
- property values_unit¶
Set unit of the z-values.
- property x_label¶
Label of the x-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
- property y_label¶
Label of the y-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
-
auto_set_axis_properties(set_x_label=
True
, set_y_label=True
)¶ Whether the axis labels and other axis properties are auto-generated.
- Parameters:¶
set_x_label (bool) – Set x-axis label automatically.
set_y_label (bool) – Set y-axis label automatically.
-
create_default_gridspec(nrows, ncols, nplots, heights=
1
, widths=1
, center_last_row=True
)¶ Create default grid for multiple plots.
- Parameters:¶
nrows (Int) – Number of rows.
ncols (int) – Number columns.
nplots (int) – Number of subplots.
heights (int (optional)) – Height of subplots.
widths (int (optional)) – Width of subplots.
center_last_row (bool (optional)) – Center the plots of the last row.
-
import_field(data_label, coordinates, values, flip_lr=
False
, flip_ud=False
, coordinates_unit=None
, values_unit=None
, text_labels=[]
)[source]¶ Import field.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
coordinates (list) – Nested list of the coordinates.
values (list) – List or nested list of the values.
flip_lr (bool (optional)) – Whether to flip the field from left to right.
flip_ud (bool (optional)) – Whether to flip the field from up to down.
coordinates_unit (str (optional)) – Unit of coordinates.
values_unit (str (optional)) – Unit of values.
text_labels (list (optional)) – List of text labels.
-
import_from_aiida_arraydata(data_label, planedata, flip_lr=
False
, flip_ud=False
, values_unit=None
, text_labels=[]
)[source]¶ Import from aiida array data.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
flip_lr (bool (optional)) – Whether to flip the field from left to right.
flip_ud (bool (optional)) – Whether to flip the field from up to down.
values_unit (str (optional)) – Unit of values.
text_labels (list (optional)) – List of text labels.
-
plot(data_labels, plot_title=
None
, plot_name='plot.png'
, subplot_assignment=None
)¶ Plot the data sets.
- Parameters:¶
data_labels (list or str) – List of data labels of the data sets that are plotted or in case only one data set is plotted a string.
plot_title (list or str (optional)) – Title of the plots or subplots.
plot_name (str (optional)) – The file name of the plot.
subplot_assignment (list or None (optional)) – Assignment of the data sets to individual subplots.
- Returns:¶
fig (matplotlib.pyplot.figure or plotly.graph_objects.Figure) – Figure object of the plot.
- reset_gridspec()¶
Reset gridspec settings.
- class aim2dat.plots.SimplePlot(**kwargs)[source]¶
Bases:
aim2dat.plots.base_plot._BasePlot
,aim2dat.plots.base_mixin._HLineMixin
,aim2dat.plots.base_mixin._VLineMixin
Direct and flexible interface to the backend plot libraries.
Overview
¶ used backend library to plot the data. Supported values are
"matplotlib"
andAlpha value(s) controlling the opacity of plot elements.
Colors used in the plot.
Hatch value(s) controlling the hatch of plot elements.
Line styles used in the plot (This feature is not supported by all plot
Line widths used in the plot (This feature is not supported by all plot
Marker types used in the plot (This feature is not supported by all plot
List of labels for the ticks on the x-axis.
List of values to set ticks on the x-axis.
List of labels for the ticks on the y-axis.
List of values to set ticks on the y-axis.
List of labels for all data sets.
Set equal aspect ratio of the plot(s).
Shift between box and anchor. The default value is
(1, 1)
.Location of the legend. The default value is
1
.Columns of the legend (only supported for the matplotlib backend).
Sort entries of the legend.
Whether to draw a grid in the plot. The default value is
False
.Length-to-width ratio of the plot given as a tuple of two numbers.
Show colorbar (not supported by all plots).
Whether to draw a grid in the plot. The default value is
False
.Show legend. The default value is
False
.Show plot. The default value is
False
.Path of the folder to store the plot. The default value is
./
.Store plot. The default value is
False
.Custom matplotlib style sheet.
Keyword arguments for the matplotlib
subplots_adjust
function.Align y label of plot. The default value is
False
.Grid spec values.
Vertical spacing between the subplots.
Number of columns. The default value is
1
.Number of rows. The default value is
2
.Use one common colorbar for all subplots.
Merge legend items of all subplots.
Share the x-axis of subplots located in the same column.
Share the y-axis of subplots located in the same row.
Title of the whole figure.
x-label of the whole figure.
y-label of the whole figure.
Tight layout of plot. The default value is
False
.Horizontal spacing between the subplots.
Label of the x-axis. If
None
is given no label will be shown. TheRange of the x-axis. The default value is
None
.Label of the y-axis. If
None
is given no label will be shown. TheRange of the y-axis. The default value is
None
.¶ add_hline
(y, x_min, x_max, color, line_style, scaled, foreground, subplot_assignment, data_label)Add a vertical line to the plot.
add_vline
(x, y_min, y_max, color, line_style, scaled, foreground, subplot_assignment, data_label)Add a vertical line to the plot.
auto_set_axis_properties
(set_x_label, set_y_label)Whether the axis labels and other axis properties are auto-generated.
create_default_gridspec
(nrows, ncols, nplots, heights, widths, center_last_row)Create default grid for multiple plots.
import_bar_data_set
(data_label, x_values, y_values, heights, plot_label, color, hatch, alpha, bottom, width, align)Import data set for a bar plot.
import_scatter_data_set
(data_label, x_values, y_values, y_values_2, plot_label, color, face_color, alpha, line_style, line_width, marker, marker_face_color, marker_edge_width, use_fill, use_fill_between)Import data set for a scatter plot.
plot
(data_labels, plot_title, plot_name, subplot_assignment)Plot the data sets.
Remove all added plot elements.
Reset gridspec settings.
Return the labels of all data sets.
- property backend¶
used backend library to plot the data. Supported values are
"matplotlib"
and"plotly"
.- Type:¶
str
- property custom_alpha¶
Alpha value(s) controlling the opacity of plot elements.
- Type:¶
float, list or tuple
- property custom_hatch¶
Hatch value(s) controlling the hatch of plot elements.
- Type:¶
float, list or tuple
- property custom_linestyles¶
Line styles used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_linewidths¶
Line widths used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_markers¶
Marker types used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property legend_bbox_to_anchor¶
Shift between box and anchor. The default value is
(1, 1)
.- Type:¶
tuple or list
- property ratio¶
Length-to-width ratio of the plot given as a tuple of two numbers.
- Type:¶
tuple or list
Use one common colorbar for all subplots.
bool
Merge legend items of all subplots.
bool
Share the x-axis of subplots located in the same column.
bool
Share the y-axis of subplots located in the same row.
bool
- property x_label¶
Label of the x-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
- property y_label¶
Label of the y-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
-
add_hline(y, x_min, x_max, color=
None
, line_style=None
, scaled=False
, foreground=False
, subplot_assignment=None
, data_label=None
)¶ Add a vertical line to the plot.
- Parameters:¶
y (float) – y-position of the line.
x_min (float) – Bottom x-position of the line.
x_max (float) – Top x-position of the line.
color (str or None) – Color of the line.
line_style (str or None) – Line style of the line.
scaled (bool) – Whether the input is given in scaled positions.
foreground (bool) – Whether to plot the line in front of the other elements.
subplot_assignment (list or None) – Assignment of the line to individual subplots.
-
add_vline(x, y_min, y_max, color=
None
, line_style=None
, scaled=False
, foreground=False
, subplot_assignment=None
, data_label=None
)¶ Add a vertical line to the plot.
- Parameters:¶
x (float) – x-position of the line.
y_min (float) – Bottom y-position of the line.
y_max (float) – Top y-position of the line.
color (str or None) – Color of the line.
line_style (str or None) – Line style of the line.
scaled (bool) – Whether the input is given in scaled positions.
foreground (bool) – Whether to plot the line in front of the other elements.
subplot_assignment (list or None) – Assignment of the line to individual subplots.
-
auto_set_axis_properties(set_x_label=
True
, set_y_label=True
)¶ Whether the axis labels and other axis properties are auto-generated.
- Parameters:¶
set_x_label (bool) – Set x-axis label automatically.
set_y_label (bool) – Set y-axis label automatically.
-
create_default_gridspec(nrows, ncols, nplots, heights=
1
, widths=1
, center_last_row=True
)¶ Create default grid for multiple plots.
- Parameters:¶
nrows (Int) – Number of rows.
ncols (int) – Number columns.
nplots (int) – Number of subplots.
heights (int (optional)) – Height of subplots.
widths (int (optional)) – Width of subplots.
center_last_row (bool (optional)) – Center the plots of the last row.
-
import_bar_data_set(data_label, x_values, y_values, heights, plot_label=
None
, color=None
, hatch=None
, alpha=None
, bottom=0.0
, width=0.8
, align='center'
)[source]¶ Import data set for a bar plot.
- Parameters:¶
data_label (str) – Internal label of the data set.
x_values (list) – List of x-values of the points.
y_values (list) – List of y-values of the points.
heights (list) – List of bar heights.
plot_label (str (optional)) – Label of the data set shown in the legend.
color (str (optional)) – Color of the data set.
hatch (str (optional)) – Hatch of the data set.
alpha (float (optional)) – Transparency of the data set.
bottom (float) – Position of the bottom of the bars.
width (float) – Width of the bars.
align (str) – Alignment of the bar.
-
import_scatter_data_set(data_label, x_values, y_values, y_values_2=
None
, plot_label=None
, color=None
, face_color=None
, alpha=None
, line_style=None
, line_width=None
, marker=None
, marker_face_color=None
, marker_edge_width=None
, use_fill=False
, use_fill_between=False
)[source]¶ Import data set for a scatter plot.
- Parameters:¶
data_label (str) – Internal label of the data set.
x_values (list) – List of x-values of the points.
y_values (list) – List of y-values of the points.
y_values_2 (list) – Second list of y-values to be used with
use_fill_between
.plot_label (str (optional)) – Label of the data set shown in the legend.
color (str (optional)) – Color of the data set.
face_color (str (optional)) – Face color of the data set.
alpha (float (optional)) – Transparency of the data set.
line_style (str (optional)) – Line style of the data set.
line_width (int or float) – Line width of the data set.
marker (str (optional)) – Marker shape.
marker_face_color (str (optional)) – Marker face color.
marker_edge_width (int (optional)) – Marker size.
use_fill (bool (optional)) – Whether to fill the area between the x-axis and the data points.
use_fill_between (bool (optional)) – Whether to fill the area between the deta sets.
-
plot(data_labels, plot_title=
None
, plot_name='plot.png'
, subplot_assignment=None
)¶ Plot the data sets.
- Parameters:¶
data_labels (list or str) – List of data labels of the data sets that are plotted or in case only one data set is plotted a string.
plot_title (list or str (optional)) – Title of the plots or subplots.
plot_name (str (optional)) – The file name of the plot.
subplot_assignment (list or None (optional)) – Assignment of the data sets to individual subplots.
- Returns:¶
fig (matplotlib.pyplot.figure or plotly.graph_objects.Figure) – Figure object of the plot.
- remove_additional_plot_elements()¶
Remove all added plot elements.
- reset_gridspec()¶
Reset gridspec settings.
-
class aim2dat.plots.SpectrumPlot(detect_peaks=
False
, smooth_spectra=False
, plot_original_spectra=False
, plot_unit_x='eV'
, **kwargs)[source]¶ Bases:
aim2dat.plots.base_plot._BasePlot
,aim2dat.plots.base_mixin._VLineMixin
,aim2dat.plots.base_mixin._PeakDetectionMixin
,aim2dat.plots.base_mixin._SmearingMixin
Plot x-ray absorption spectra.
- Variables:¶
- detect_peaks : bool¶
Whether to detect peaks of the spectra.
- smooth_spectra : bool¶
Whether to broaden the spectra.
- plot_original_spectra : bool¶
Whether to plot the original spectra (in addition to the broadened spectra).
- plot_unit_x : str¶
Unit of the x-values. Imported spectra are transformed to the corresponding unit if the unit of the imported data set is given.
Overview
¶ used backend library to plot the data. Supported values are
"matplotlib"
andAlpha value(s) controlling the opacity of plot elements.
Colors used in the plot.
Hatch value(s) controlling the hatch of plot elements.
Line styles used in the plot (This feature is not supported by all plot
Line widths used in the plot (This feature is not supported by all plot
Marker types used in the plot (This feature is not supported by all plot
List of labels for the ticks on the x-axis.
List of values to set ticks on the x-axis.
List of labels for the ticks on the y-axis.
List of values to set ticks on the y-axis.
List of labels for all data sets.
Set equal aspect ratio of the plot(s).
Shift between box and anchor. The default value is
(1, 1)
.Location of the legend. The default value is
1
.Columns of the legend (only supported for the matplotlib backend).
Sort entries of the legend.
-
-
-
-
-
-
-
-
-
-
-
-
-
Whether to draw a grid in the plot. The default value is
False
.Set unit of x-axis.
Length-to-width ratio of the plot given as a tuple of two numbers.
Show colorbar (not supported by all plots).
Whether to draw a grid in the plot. The default value is
False
.Show legend. The default value is
False
.Show plot. The default value is
False
.Spacing between two values. If set to
None
the original function isMethod used to smear out the functions. Supported options are
'gaussian'
andSigma value of the smearing distribution.
Path of the folder to store the plot. The default value is
./
.Store plot. The default value is
False
.Custom matplotlib style sheet.
Keyword arguments for the matplotlib
subplots_adjust
function.Align y label of plot. The default value is
False
.Grid spec values.
Vertical spacing between the subplots.
Number of columns. The default value is
1
.Number of rows. The default value is
2
.Use one common colorbar for all subplots.
Merge legend items of all subplots.
Share the x-axis of subplots located in the same column.
Share the y-axis of subplots located in the same row.
Title of the whole figure.
x-label of the whole figure.
y-label of the whole figure.
Tight layout of plot. The default value is
False
.Horizontal spacing between the subplots.
Label of the x-axis. If
None
is given no label will be shown. TheRange of the x-axis. The default value is
None
.Label of the y-axis. If
None
is given no label will be shown. TheRange of the y-axis. The default value is
None
.¶ add_vline
(x, y_min, y_max, color, line_style, scaled, foreground, subplot_assignment, data_label)Add a vertical line to the plot.
auto_set_axis_properties
(set_x_label, set_y_label)Whether the axis labels and other axis properties are auto-generated.
create_default_gridspec
(nrows, ncols, nplots, heights, widths, center_last_row)Create default grid for multiple plots.
import_spectrum
(data_label, x_values, y_values, unit_x)Import spectrum.
plot
(data_labels, plot_title, plot_name, subplot_assignment)Plot the data sets.
Remove all added plot elements.
Reset gridspec settings.
Return the labels of all data sets.
- property backend¶
used backend library to plot the data. Supported values are
"matplotlib"
and"plotly"
.- Type:¶
str
- property custom_alpha¶
Alpha value(s) controlling the opacity of plot elements.
- Type:¶
float, list or tuple
- property custom_hatch¶
Hatch value(s) controlling the hatch of plot elements.
- Type:¶
float, list or tuple
- property custom_linestyles¶
Line styles used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_linewidths¶
Line widths used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_markers¶
Marker types used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property legend_bbox_to_anchor¶
Shift between box and anchor. The default value is
(1, 1)
.- Type:¶
tuple or list
- property peak_color¶
- property peak_distance¶
- property peak_height¶
- property peak_line_style¶
- property peak_max_factor¶
- property peak_plateau_size¶
- property peak_prominence¶
- property peak_rel_height¶
- property peak_threshold¶
- property peak_width¶
- property peak_wlen¶
- property peak_y_min¶
- property peaks¶
- property plot_unit_x¶
Set unit of x-axis.
- property ratio¶
Length-to-width ratio of the plot given as a tuple of two numbers.
- Type:¶
tuple or list
- property smearing_delta¶
Spacing between two values. If set to
None
the original function is used.- Type:¶
float or None
- property smearing_method¶
Method used to smear out the functions. Supported options are
'gaussian'
and'lorentzian'
.- Type:¶
str
Use one common colorbar for all subplots.
bool
Merge legend items of all subplots.
bool
Share the x-axis of subplots located in the same column.
bool
Share the y-axis of subplots located in the same row.
bool
- property x_label¶
Label of the x-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
- property y_label¶
Label of the y-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
-
add_vline(x, y_min, y_max, color=
None
, line_style=None
, scaled=False
, foreground=False
, subplot_assignment=None
, data_label=None
)¶ Add a vertical line to the plot.
- Parameters:¶
x (float) – x-position of the line.
y_min (float) – Bottom y-position of the line.
y_max (float) – Top y-position of the line.
color (str or None) – Color of the line.
line_style (str or None) – Line style of the line.
scaled (bool) – Whether the input is given in scaled positions.
foreground (bool) – Whether to plot the line in front of the other elements.
subplot_assignment (list or None) – Assignment of the line to individual subplots.
-
auto_set_axis_properties(set_x_label=
True
, set_y_label=True
)¶ Whether the axis labels and other axis properties are auto-generated.
- Parameters:¶
set_x_label (bool) – Set x-axis label automatically.
set_y_label (bool) – Set y-axis label automatically.
-
create_default_gridspec(nrows, ncols, nplots, heights=
1
, widths=1
, center_last_row=True
)¶ Create default grid for multiple plots.
- Parameters:¶
nrows (Int) – Number of rows.
ncols (int) – Number columns.
nplots (int) – Number of subplots.
heights (int (optional)) – Height of subplots.
widths (int (optional)) – Width of subplots.
center_last_row (bool (optional)) – Center the plots of the last row.
- import_spectrum(data_label, x_values, y_values, unit_x)[source]¶
Import spectrum.
- Parameters:¶
data_label (str) – Internal label of the data set.
x_values (list) – x-values of the spectrum.
y_values (list) – y-values of the spectrum.
unit_x (str) – Unit of the x-values.
-
plot(data_labels, plot_title=
None
, plot_name='plot.png'
, subplot_assignment=None
)¶ Plot the data sets.
- Parameters:¶
data_labels (list or str) – List of data labels of the data sets that are plotted or in case only one data set is plotted a string.
plot_title (list or str (optional)) – Title of the plots or subplots.
plot_name (str (optional)) – The file name of the plot.
subplot_assignment (list or None (optional)) – Assignment of the data sets to individual subplots.
- Returns:¶
fig (matplotlib.pyplot.figure or plotly.graph_objects.Figure) – Figure object of the plot.
- remove_additional_plot_elements()¶
Remove all added plot elements.
- reset_gridspec()¶
Reset gridspec settings.
-
class aim2dat.plots.SurfacePlot(area_unit=
'angstrom'
, energy_unit='eV'
, plot_element=None
, plot_type='chem_potential'
, plot_properties='surface_energy'
, plot_labels=None
, show_x_label=True
, show_y_label=True
, **kwargs)[source]¶ Bases:
aim2dat.plots.base_plot._BasePlot
Plot the surface energy with respect to the chemical potential.
Overview
¶ Unit of the surface area.
used backend library to plot the data. Supported values are
"matplotlib"
andBulk phase.
Alpha value(s) controlling the opacity of plot elements.
Colors used in the plot.
Hatch value(s) controlling the hatch of plot elements.
Line styles used in the plot (This feature is not supported by all plot
Line widths used in the plot (This feature is not supported by all plot
Marker types used in the plot (This feature is not supported by all plot
List of labels for the ticks on the x-axis.
List of values to set ticks on the x-axis.
List of labels for the ticks on the y-axis.
List of values to set ticks on the y-axis.
List of labels for all data sets.
Elemental phases.
Energy unit.
Set equal aspect ratio of the plot(s).
Shift between box and anchor. The default value is
(1, 1)
.Location of the legend. The default value is
1
.Columns of the legend (only supported for the matplotlib backend).
Sort entries of the legend.
Whether to draw a grid in the plot. The default value is
False
.Properties that are plotted on the y-axis.
Plot type. Supported options are ‘chem_potential’ or ‘excess_atoms’.
Length-to-width ratio of the plot given as a tuple of two numbers.
Show colorbar (not supported by all plots).
Whether to draw a grid in the plot. The default value is
False
.Show legend. The default value is
False
.Show plot. The default value is
False
.Path of the folder to store the plot. The default value is
./
.Store plot. The default value is
False
.Custom matplotlib style sheet.
Keyword arguments for the matplotlib
subplots_adjust
function.Align y label of plot. The default value is
False
.Grid spec values.
Vertical spacing between the subplots.
Number of columns. The default value is
1
.Number of rows. The default value is
2
.Use one common colorbar for all subplots.
Merge legend items of all subplots.
Share the x-axis of subplots located in the same column.
Share the y-axis of subplots located in the same row.
Title of the whole figure.
x-label of the whole figure.
y-label of the whole figure.
Tight layout of plot. The default value is
False
.Horizontal spacing between the subplots.
Label of the x-axis. If
None
is given no label will be shown. TheRange of the x-axis. The default value is
None
.Label of the y-axis. If
None
is given no label will be shown. TheRange of the y-axis. The default value is
None
.¶ add_surface_facet
(data_label, formula, total_energy, surface_area, miller_indices, termination_label, area_unit, energy_unit, **kwargs)Add surface.
auto_set_axis_properties
(set_x_label, set_y_label)Whether the axis labels and other axis properties are auto-generated.
create_default_gridspec
(nrows, ncols, nplots, heights, widths, center_last_row)Create default grid for multiple plots.
import_from_pandas_df
(data_label, data_frame, termination_labels, ter_labeling_scheme, extract_electronic_properties)Import surface facets from a results pandas data frame of the workflow builder.
plot
(data_labels, plot_title, plot_name, subplot_assignment)Plot the data sets.
Reset gridspec settings.
Return the labels of all data sets.
set_bulk_phase
(formula, total_energy, unit)Set bulk phase.
set_elemental_phase
(element, total_energy, nr_atoms, unit)Set elemental phase.
- property backend¶
used backend library to plot the data. Supported values are
"matplotlib"
and"plotly"
.- Type:¶
str
- property bulk_phase¶
Bulk phase.
- property custom_alpha¶
Alpha value(s) controlling the opacity of plot elements.
- Type:¶
float, list or tuple
- property custom_hatch¶
Hatch value(s) controlling the hatch of plot elements.
- Type:¶
float, list or tuple
- property custom_linestyles¶
Line styles used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_linewidths¶
Line widths used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_markers¶
Marker types used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property elemental_phases¶
Elemental phases.
- property legend_bbox_to_anchor¶
Shift between box and anchor. The default value is
(1, 1)
.- Type:¶
tuple or list
- property ratio¶
Length-to-width ratio of the plot given as a tuple of two numbers.
- Type:¶
tuple or list
Use one common colorbar for all subplots.
bool
Merge legend items of all subplots.
bool
Share the x-axis of subplots located in the same column.
bool
Share the y-axis of subplots located in the same row.
bool
- property x_label¶
Label of the x-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
- property y_label¶
Label of the y-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
-
add_surface_facet(data_label, formula, total_energy, surface_area, miller_indices=
None
, termination_label=None
, area_unit='angstrom'
, energy_unit='eV'
, **kwargs)[source]¶ Add surface.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
formula (dict, list or str) – Chemical formula of the surface slab.
total_energy (float) – Total energy of the surface slab.
surface_area (float) – Surface area of the facet.
area_unit (str (optional)) – Unit of the surface area. The default value is
'angstrom'
.energy_unit (str (optional)) – Unit of the energy. The default value is
'eV'
.
-
auto_set_axis_properties(set_x_label=
True
, set_y_label=True
)¶ Whether the axis labels and other axis properties are auto-generated.
- Parameters:¶
set_x_label (bool) – Set x-axis label automatically.
set_y_label (bool) – Set y-axis label automatically.
-
create_default_gridspec(nrows, ncols, nplots, heights=
1
, widths=1
, center_last_row=True
)¶ Create default grid for multiple plots.
- Parameters:¶
nrows (Int) – Number of rows.
ncols (int) – Number columns.
nplots (int) – Number of subplots.
heights (int (optional)) – Height of subplots.
widths (int (optional)) – Width of subplots.
center_last_row (bool (optional)) – Center the plots of the last row.
-
import_from_pandas_df(data_label, data_frame, termination_labels=
None
, ter_labeling_scheme=None
, extract_electronic_properties=False
)[source]¶ Import surface facets from a results pandas data frame of the workflow builder.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
data_frame (pandas.DataFrame) – Pandas data frame.
termination_labels (list (optional)) – List of termination indicies. If set to
None
the termination index for each facet is extracted from the input SurfaceData of the workflow.ter_labeling_scheme (str (optional)) – Automatic labeling for surface slabs.
extract_electronic_properties (bool (optional)) – Whether to extract the band gap and the ionization potential from the calculated band structure.
-
plot(data_labels, plot_title=
None
, plot_name='plot.png'
, subplot_assignment=None
)¶ Plot the data sets.
- Parameters:¶
data_labels (list or str) – List of data labels of the data sets that are plotted or in case only one data set is plotted a string.
plot_title (list or str (optional)) – Title of the plots or subplots.
plot_name (str (optional)) – The file name of the plot.
subplot_assignment (list or None (optional)) – Assignment of the data sets to individual subplots.
- Returns:¶
fig (matplotlib.pyplot.figure or plotly.graph_objects.Figure) – Figure object of the plot.
- reset_gridspec()¶
Reset gridspec settings.
- return_data_labels()¶
Return the labels of all data sets.
- Returns:¶
data_labels (list) – List of the labels of all data sets.
-
set_bulk_phase(formula, total_energy, unit=
'eV'
)[source]¶ Set bulk phase.
- Parameters:¶
formula (dict, list or str) – Chemical formula of the bulk phase.
total_energy (float) – Total energy of the phase.
unit (str (optional)) – Unit of the energy. The default value is
'eV'
.
-
set_elemental_phase(element, total_energy, nr_atoms=
1
, unit='eV'
)[source]¶ Set elemental phase.
- Parameters:¶
element (str, int) – Name, symbol or atomic number of the element.
total_energy (float) – Total energy of the phase.
nr_atoms (int (optional)) – Number of atoms of the phase. The default value is
1
.unit (str (optional)) – Unit of the energy. The default value is
'eV'
.