aim2dat.plots

Specific classes to prepare and plot data.

Package Contents

Classes

BandStructureDOSPlot

Class to plot the band structure combined with the density of states.

BandStructurePlot

Plot the band structure of a crystalline structure.

DOSPlot

Class to plot the density of states.

PartialChargesPlot

Plot the partial charges.

PartialRDFPlot

Plot the partial radial distribution function.

PhasePlot

Plot the formation energy of binary and ternary material systems.

PlanarFieldPlot

Plot scalar planar fields.

SimplePlot

Direct and flexible interface to the backend plot libraries.

SpectrumPlot

Plot x-ray absorption spectra.

SurfacePlot

Plot the surface energy with respect to the chemical potential.

Functions

BandStructure(*args, **kwargs)

Depreciated band structure class.

BandStructureDensityOfStates(*args, **kwargs)

Depreciated band structure DOS class.

DensityOfStates(*args, **kwargs)

Depreciated DOS class.

PhaseDiagram(*args, **kwargs)

Depreciated PhaseDiagram class.

Spectrum(*args, **kwargs)

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 to True 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

Properties

backend

used backend library to plot the data. Supported values are "matplotlib" and

custom_alpha

Alpha value(s) controlling the opacity of plot elements.

custom_colors

Colors used in the plot.

custom_hatch

Hatch value(s) controlling the hatch of plot elements.

custom_linestyles

Line styles used in the plot (This feature is not supported by all plot

custom_linewidths

Line widths used in the plot (This feature is not supported by all plot

custom_markers

Marker types used in the plot (This feature is not supported by all plot

custom_xticklabels

List of labels for the ticks on the x-axis.

custom_xticks

List of values to set ticks on the x-axis.

custom_yticklabels

List of labels for the ticks on the y-axis.

custom_yticks

List of values to set ticks on the y-axis.

data_labels

List of labels for all data sets.

equal_aspect_ratio

Set equal aspect ratio of the plot(s).

legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

legend_loc

Location of the legend. The default value is 1.

legend_ncol

Columns of the legend (only supported for the matplotlib backend).

legend_sort_entries

Sort entries of the legend.

pdos_plot_type

plot type of the pDOS data sets, supported options are 'line', 'fill'

plot_grid

Whether to draw a grid in the plot. The default value is False.

ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

show_colorbar

Show colorbar (not supported by all plots).

show_grid

Whether to draw a grid in the plot. The default value is False.

show_legend

Show legend. The default value is False.

show_plot

Show plot. The default value is False.

smearing_delta

Spacing between two values. If set to None the original function is

smearing_method

Method used to smear out the functions. Supported options are 'gaussian' and

smearing_sigma

Sigma value of the smearing distribution.

store_path

Path of the folder to store the plot. The default value is ./.

store_plot

Store plot. The default value is False.

style_sheet

Custom matplotlib style sheet.

subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

subplot_align_ylabels

Align y label of plot. The default value is False.

subplot_gridspec

Grid spec values.

subplot_hspace

Vertical spacing between the subplots.

subplot_ncols

Number of columns. The default value is 1.

subplot_nrows

Number of rows. The default value is 2.

subplot_share_colorbar

Use one common colorbar for all subplots.

subplot_share_legend

Merge legend items of all subplots.

subplot_sharex

Share the x-axis of subplots located in the same column.

subplot_sharey

Share the y-axis of subplots located in the same row.

subplot_sup_title

Title of the whole figure.

subplot_sup_x_label

x-label of the whole figure.

subplot_sup_y_label

y-label of the whole figure.

subplot_tight_layout

Tight layout of plot. The default value is False.

subplot_wspace

Horizontal spacing between the subplots.

tdos_plot_type

plot type of the tDOS data sets, supported options are 'line', 'fill'

x_label

Label of the x-axis. If None is given no label will be shown. The

x_range

Range of the x-axis. The default value is None.

y_label

Label of the y-axis. If None is given no label will be shown. The

y_range

Range of the y-axis. The default value is None.

Methods

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_additional_plot_elements()

Remove all added plot elements.

reset_gridspec()

Reset gridspec settings.

return_data_labels()

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_colors

Colors used in the plot.

Type:

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 custom_xticklabels

List of labels for the ticks on the x-axis.

Type:

list

property custom_xticks

List of values to set ticks on the x-axis.

Type:

list

property custom_yticklabels

List of labels for the ticks on the y-axis.

Type:

list

property custom_yticks

List of values to set ticks on the y-axis.

Type:

list

property data_labels

List of labels for all data sets.

Type:

list

property equal_aspect_ratio

Set equal aspect ratio of the plot(s).

Type:

bool

property legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

Type:

tuple or list

property legend_loc

Location of the legend. The default value is 1.

Type:

int

property legend_ncol

Columns of the legend (only supported for the matplotlib backend).

Type:

int

property legend_sort_entries

Sort entries of the legend.

Type:

bool

property pdos_plot_type

plot type of the pDOS data sets, supported options are 'line', 'fill' and 'linefill'.

Type:

str

property plot_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

Type:

tuple or list

property show_colorbar

Show colorbar (not supported by all plots).

Type:

bool

property show_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property show_legend

Show legend. The default value is False.

Type:

bool

property show_plot

Show plot. The default value is False.

Type:

bool

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

property smearing_sigma

Sigma value of the smearing distribution.

Type:

float

property store_path

Path of the folder to store the plot. The default value is ./.

Type:

str

property store_plot

Store plot. The default value is False.

Type:

bool

property style_sheet

Custom matplotlib style sheet.

Type:

str

property subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

Type:

dict

property subplot_align_ylabels

Align y label of plot. The default value is False.

Type:

bool

property subplot_gridspec

Grid spec values.

Type:

list or tuple

property subplot_hspace

Vertical spacing between the subplots.

Type:

float

property subplot_ncols

Number of columns. The default value is 1.

Type:

int

property subplot_nrows

Number of rows. The default value is 2.

Type:

int

property subplot_share_colorbar

Use one common colorbar for all subplots.

Type:

bool

property subplot_share_legend

Merge legend items of all subplots.

Type:

bool

property subplot_sharex

Share the x-axis of subplots located in the same column.

Type:

bool

property subplot_sharey

Share the y-axis of subplots located in the same row.

Type:

bool

property subplot_sup_title

Title of the whole figure.

Type:

str

property subplot_sup_x_label

x-label of the whole figure.

Type:

str

property subplot_sup_y_label

y-label of the whole figure.

Type:

str

property subplot_tight_layout

Tight layout of plot. The default value is False.

Type:

bool

property subplot_wspace

Horizontal spacing between the subplots.

Type:

float

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 is None.

Type:

str or None

property x_range

Range of the x-axis. The default value is None.

Type:

tuple or list

property y_label

Label of the y-axis. If None is given no label will be shown. The default value is None.

Type:

str or None

property y_range

Range of the y-axis. The default value is None.

Type:

tuple or list

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.

shift_bands_and_dos_to_vbm(data_label)[source]

Shift the bands and the density of states such that the VBM is zero.

Parameters:

data_label (str) – Data label of the data set.

shift_dos(data_label, shift)

Shift density of states.

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

Properties

backend

used backend library to plot the data. Supported values are "matplotlib" and

custom_alpha

Alpha value(s) controlling the opacity of plot elements.

custom_colors

Colors used in the plot.

custom_hatch

Hatch value(s) controlling the hatch of plot elements.

custom_linestyles

Line styles used in the plot (This feature is not supported by all plot

custom_linewidths

Line widths used in the plot (This feature is not supported by all plot

custom_markers

Marker types used in the plot (This feature is not supported by all plot

custom_xticklabels

List of labels for the ticks on the x-axis.

custom_xticks

List of values to set ticks on the x-axis.

custom_yticklabels

List of labels for the ticks on the y-axis.

custom_yticks

List of values to set ticks on the y-axis.

data_labels

List of labels for all data sets.

equal_aspect_ratio

Set equal aspect ratio of the plot(s).

legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

legend_loc

Location of the legend. The default value is 1.

legend_ncol

Columns of the legend (only supported for the matplotlib backend).

legend_sort_entries

Sort entries of the legend.

plot_grid

Whether to draw a grid in the plot. The default value is False.

ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

show_colorbar

Show colorbar (not supported by all plots).

show_grid

Whether to draw a grid in the plot. The default value is False.

show_legend

Show legend. The default value is False.

show_plot

Show plot. The default value is False.

store_path

Path of the folder to store the plot. The default value is ./.

store_plot

Store plot. The default value is False.

style_sheet

Custom matplotlib style sheet.

subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

subplot_align_ylabels

Align y label of plot. The default value is False.

subplot_gridspec

Grid spec values.

subplot_hspace

Vertical spacing between the subplots.

subplot_ncols

Number of columns. The default value is 1.

subplot_nrows

Number of rows. The default value is 2.

subplot_share_colorbar

Use one common colorbar for all subplots.

subplot_share_legend

Merge legend items of all subplots.

subplot_sharex

Share the x-axis of subplots located in the same column.

subplot_sharey

Share the y-axis of subplots located in the same row.

subplot_sup_title

Title of the whole figure.

subplot_sup_x_label

x-label of the whole figure.

subplot_sup_y_label

y-label of the whole figure.

subplot_tight_layout

Tight layout of plot. The default value is False.

subplot_wspace

Horizontal spacing between the subplots.

x_label

Label of the x-axis. If None is given no label will be shown. The

x_range

Range of the x-axis. The default value is None.

y_label

Label of the y-axis. If None is given no label will be shown. The

y_range

Range of the y-axis. The default value is None.

Methods

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_additional_plot_elements()

Remove all added plot elements.

reset_gridspec()

Reset gridspec settings.

return_data_labels()

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_colors

Colors used in the plot.

Type:

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 custom_xticklabels

List of labels for the ticks on the x-axis.

Type:

list

property custom_xticks

List of values to set ticks on the x-axis.

Type:

list

property custom_yticklabels

List of labels for the ticks on the y-axis.

Type:

list

property custom_yticks

List of values to set ticks on the y-axis.

Type:

list

property data_labels

List of labels for all data sets.

Type:

list

property equal_aspect_ratio

Set equal aspect ratio of the plot(s).

Type:

bool

property legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

Type:

tuple or list

property legend_loc

Location of the legend. The default value is 1.

Type:

int

property legend_ncol

Columns of the legend (only supported for the matplotlib backend).

Type:

int

property legend_sort_entries

Sort entries of the legend.

Type:

bool

property plot_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

Type:

tuple or list

property show_colorbar

Show colorbar (not supported by all plots).

Type:

bool

property show_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property show_legend

Show legend. The default value is False.

Type:

bool

property show_plot

Show plot. The default value is False.

Type:

bool

property store_path

Path of the folder to store the plot. The default value is ./.

Type:

str

property store_plot

Store plot. The default value is False.

Type:

bool

property style_sheet

Custom matplotlib style sheet.

Type:

str

property subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

Type:

dict

property subplot_align_ylabels

Align y label of plot. The default value is False.

Type:

bool

property subplot_gridspec

Grid spec values.

Type:

list or tuple

property subplot_hspace

Vertical spacing between the subplots.

Type:

float

property subplot_ncols

Number of columns. The default value is 1.

Type:

int

property subplot_nrows

Number of rows. The default value is 2.

Type:

int

property subplot_share_colorbar

Use one common colorbar for all subplots.

Type:

bool

property subplot_share_legend

Merge legend items of all subplots.

Type:

bool

property subplot_sharex

Share the x-axis of subplots located in the same column.

Type:

bool

property subplot_sharey

Share the y-axis of subplots located in the same row.

Type:

bool

property subplot_sup_title

Title of the whole figure.

Type:

str

property subplot_sup_x_label

x-label of the whole figure.

Type:

str

property subplot_sup_y_label

y-label of the whole figure.

Type:

str

property subplot_tight_layout

Tight layout of plot. The default value is False.

Type:

bool

property subplot_wspace

Horizontal spacing between the subplots.

Type:

float

property x_label

Label of the x-axis. If None is given no label will be shown. The default value is None.

Type:

str or None

property x_range

Range of the x-axis. The default value is None.

Type:

tuple or list

property y_label

Label of the y-axis. If None is given no label will be shown. The default value is None.

Type:

str or None

property y_range

Range of the y-axis. The default value is None.

Type:

tuple or list

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.

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’).

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 to True 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

Properties

backend

used backend library to plot the data. Supported values are "matplotlib" and

custom_alpha

Alpha value(s) controlling the opacity of plot elements.

custom_colors

Colors used in the plot.

custom_hatch

Hatch value(s) controlling the hatch of plot elements.

custom_linestyles

Line styles used in the plot (This feature is not supported by all plot

custom_linewidths

Line widths used in the plot (This feature is not supported by all plot

custom_markers

Marker types used in the plot (This feature is not supported by all plot

custom_xticklabels

List of labels for the ticks on the x-axis.

custom_xticks

List of values to set ticks on the x-axis.

custom_yticklabels

List of labels for the ticks on the y-axis.

custom_yticks

List of values to set ticks on the y-axis.

data_labels

List of labels for all data sets.

equal_aspect_ratio

Set equal aspect ratio of the plot(s).

legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

legend_loc

Location of the legend. The default value is 1.

legend_ncol

Columns of the legend (only supported for the matplotlib backend).

legend_sort_entries

Sort entries of the legend.

pdos_plot_type

plot type of the pDOS data sets, supported options are 'line', 'fill'

plot_grid

Whether to draw a grid in the plot. The default value is False.

ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

show_colorbar

Show colorbar (not supported by all plots).

show_grid

Whether to draw a grid in the plot. The default value is False.

show_legend

Show legend. The default value is False.

show_plot

Show plot. The default value is False.

smearing_delta

Spacing between two values. If set to None the original function is

smearing_method

Method used to smear out the functions. Supported options are 'gaussian' and

smearing_sigma

Sigma value of the smearing distribution.

store_path

Path of the folder to store the plot. The default value is ./.

store_plot

Store plot. The default value is False.

style_sheet

Custom matplotlib style sheet.

subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

subplot_align_ylabels

Align y label of plot. The default value is False.

subplot_gridspec

Grid spec values.

subplot_hspace

Vertical spacing between the subplots.

subplot_ncols

Number of columns. The default value is 1.

subplot_nrows

Number of rows. The default value is 2.

subplot_share_colorbar

Use one common colorbar for all subplots.

subplot_share_legend

Merge legend items of all subplots.

subplot_sharex

Share the x-axis of subplots located in the same column.

subplot_sharey

Share the y-axis of subplots located in the same row.

subplot_sup_title

Title of the whole figure.

subplot_sup_x_label

x-label of the whole figure.

subplot_sup_y_label

y-label of the whole figure.

subplot_tight_layout

Tight layout of plot. The default value is False.

subplot_wspace

Horizontal spacing between the subplots.

tdos_plot_type

plot type of the tDOS data sets, supported options are 'line', 'fill'

x_label

Label of the x-axis. If None is given no label will be shown. The

x_range

Range of the x-axis. The default value is None.

y_label

Label of the y-axis. If None is given no label will be shown. The

y_range

Range of the y-axis. The default value is None.

Methods

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_additional_plot_elements()

Remove all added plot elements.

reset_gridspec()

Reset gridspec settings.

return_data_labels()

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_colors

Colors used in the plot.

Type:

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 custom_xticklabels

List of labels for the ticks on the x-axis.

Type:

list

property custom_xticks

List of values to set ticks on the x-axis.

Type:

list

property custom_yticklabels

List of labels for the ticks on the y-axis.

Type:

list

property custom_yticks

List of values to set ticks on the y-axis.

Type:

list

property data_labels

List of labels for all data sets.

Type:

list

property equal_aspect_ratio

Set equal aspect ratio of the plot(s).

Type:

bool

property legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

Type:

tuple or list

property legend_loc

Location of the legend. The default value is 1.

Type:

int

property legend_ncol

Columns of the legend (only supported for the matplotlib backend).

Type:

int

property legend_sort_entries

Sort entries of the legend.

Type:

bool

property pdos_plot_type

plot type of the pDOS data sets, supported options are 'line', 'fill' and 'linefill'.

Type:

str

property plot_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

Type:

tuple or list

property show_colorbar

Show colorbar (not supported by all plots).

Type:

bool

property show_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property show_legend

Show legend. The default value is False.

Type:

bool

property show_plot

Show plot. The default value is False.

Type:

bool

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

property smearing_sigma

Sigma value of the smearing distribution.

Type:

float

property store_path

Path of the folder to store the plot. The default value is ./.

Type:

str

property store_plot

Store plot. The default value is False.

Type:

bool

property style_sheet

Custom matplotlib style sheet.

Type:

str

property subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

Type:

dict

property subplot_align_ylabels

Align y label of plot. The default value is False.

Type:

bool

property subplot_gridspec

Grid spec values.

Type:

list or tuple

property subplot_hspace

Vertical spacing between the subplots.

Type:

float

property subplot_ncols

Number of columns. The default value is 1.

Type:

int

property subplot_nrows

Number of rows. The default value is 2.

Type:

int

property subplot_share_colorbar

Use one common colorbar for all subplots.

Type:

bool

property subplot_share_legend

Merge legend items of all subplots.

Type:

bool

property subplot_sharex

Share the x-axis of subplots located in the same column.

Type:

bool

property subplot_sharey

Share the y-axis of subplots located in the same row.

Type:

bool

property subplot_sup_title

Title of the whole figure.

Type:

str

property subplot_sup_x_label

x-label of the whole figure.

Type:

str

property subplot_sup_y_label

y-label of the whole figure.

Type:

str

property subplot_tight_layout

Tight layout of plot. The default value is False.

Type:

bool

property subplot_wspace

Horizontal spacing between the subplots.

Type:

float

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 is None.

Type:

str or None

property x_range

Range of the x-axis. The default value is None.

Type:

tuple or list

property y_label

Label of the y-axis. If None is given no label will be shown. The default value is None.

Type:

str or None

property y_range

Range of the y-axis. The default value is None.

Type:

tuple or list

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.

return_data_labels()

Return the labels of all data sets.

Returns:

data_labels (list) – List of the labels of all data sets.

shift_dos(data_label, shift)

Shift density of states.

Parameters:
  • data_label (str) – Data label of the data set.

  • shift (float) – Value to shift band structure and density of states.

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

Properties

backend

used backend library to plot the data. Supported values are "matplotlib" and

custom_alpha

Alpha value(s) controlling the opacity of plot elements.

custom_colors

Colors used in the plot.

custom_hatch

Hatch value(s) controlling the hatch of plot elements.

custom_linestyles

Line styles used in the plot (This feature is not supported by all plot

custom_linewidths

Line widths used in the plot (This feature is not supported by all plot

custom_markers

Marker types used in the plot (This feature is not supported by all plot

custom_xticklabels

List of labels for the ticks on the x-axis.

custom_xticks

List of values to set ticks on the x-axis.

custom_yticklabels

List of labels for the ticks on the y-axis.

custom_yticks

List of values to set ticks on the y-axis.

data_labels

List of labels for all data sets.

equal_aspect_ratio

Set equal aspect ratio of the plot(s).

legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

legend_loc

Location of the legend. The default value is 1.

legend_ncol

Columns of the legend (only supported for the matplotlib backend).

legend_sort_entries

Sort entries of the legend.

pc_plot_order

List of plot assignments to order the plotted data.

pc_plot_type

plot type of the partial charge data sets,

plot_grid

Whether to draw a grid in the plot. The default value is False.

ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

show_colorbar

Show colorbar (not supported by all plots).

show_grid

Whether to draw a grid in the plot. The default value is False.

show_legend

Show legend. The default value is False.

show_plot

Show plot. The default value is False.

store_path

Path of the folder to store the plot. The default value is ./.

store_plot

Store plot. The default value is False.

style_sheet

Custom matplotlib style sheet.

subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

subplot_align_ylabels

Align y label of plot. The default value is False.

subplot_gridspec

Grid spec values.

subplot_hspace

Vertical spacing between the subplots.

subplot_ncols

Number of columns. The default value is 1.

subplot_nrows

Number of rows. The default value is 2.

subplot_share_colorbar

Use one common colorbar for all subplots.

subplot_share_legend

Merge legend items of all subplots.

subplot_sharex

Share the x-axis of subplots located in the same column.

subplot_sharey

Share the y-axis of subplots located in the same row.

subplot_sup_title

Title of the whole figure.

subplot_sup_x_label

x-label of the whole figure.

subplot_sup_y_label

y-label of the whole figure.

subplot_tight_layout

Tight layout of plot. The default value is False.

subplot_wspace

Horizontal spacing between the subplots.

x_label

Label of the x-axis. If None is given no label will be shown. The

x_range

Range of the x-axis. The default value is None.

y_label

Label of the y-axis. If None is given no label will be shown. The

y_range

Range of the y-axis. The default value is None.

Methods

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()

Reset gridspec settings.

return_data_labels()

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_colors

Colors used in the plot.

Type:

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 custom_xticklabels

List of labels for the ticks on the x-axis.

Type:

list

property custom_xticks

List of values to set ticks on the x-axis.

Type:

list

property custom_yticklabels

List of labels for the ticks on the y-axis.

Type:

list

property custom_yticks

List of values to set ticks on the y-axis.

Type:

list

property data_labels

List of labels for all data sets.

Type:

list

property equal_aspect_ratio

Set equal aspect ratio of the plot(s).

Type:

bool

property legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

Type:

tuple or list

property legend_loc

Location of the legend. The default value is 1.

Type:

int

property legend_ncol

Columns of the legend (only supported for the matplotlib backend).

Type:

int

property legend_sort_entries

Sort entries of the legend.

Type:

bool

property pc_plot_order

List of plot assignments to order the plotted data.

Type:

list

property pc_plot_type

plot type of the partial charge data sets, supported options are 'scatter', 'bar'.

Type:

str

property plot_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

Type:

tuple or list

property show_colorbar

Show colorbar (not supported by all plots).

Type:

bool

property show_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property show_legend

Show legend. The default value is False.

Type:

bool

property show_plot

Show plot. The default value is False.

Type:

bool

property store_path

Path of the folder to store the plot. The default value is ./.

Type:

str

property store_plot

Store plot. The default value is False.

Type:

bool

property style_sheet

Custom matplotlib style sheet.

Type:

str

property subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

Type:

dict

property subplot_align_ylabels

Align y label of plot. The default value is False.

Type:

bool

property subplot_gridspec

Grid spec values.

Type:

list or tuple

property subplot_hspace

Vertical spacing between the subplots.

Type:

float

property subplot_ncols

Number of columns. The default value is 1.

Type:

int

property subplot_nrows

Number of rows. The default value is 2.

Type:

int

property subplot_share_colorbar

Use one common colorbar for all subplots.

Type:

bool

property subplot_share_legend

Merge legend items of all subplots.

Type:

bool

property subplot_sharex

Share the x-axis of subplots located in the same column.

Type:

bool

property subplot_sharey

Share the y-axis of subplots located in the same row.

Type:

bool

property subplot_sup_title

Title of the whole figure.

Type:

str

property subplot_sup_x_label

x-label of the whole figure.

Type:

str

property subplot_sup_y_label

y-label of the whole figure.

Type:

str

property subplot_tight_layout

Tight layout of plot. The default value is False.

Type:

bool

property subplot_wspace

Horizontal spacing between the subplots.

Type:

float

property x_label

Label of the x-axis. If None is given no label will be shown. The default value is None.

Type:

str or None

property x_range

Range of the x-axis. The default value is None.

Type:

tuple or list

property y_label

Label of the y-axis. If None is given no label will be shown. The default value is None.

Type:

str or None

property y_range

Range of the y-axis. The default value is None.

Type:

tuple or list

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.

return_data_labels()

Return the labels of all data sets.

Returns:

data_labels (list) – List of the labels of all data sets.

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

Properties

backend

used backend library to plot the data. Supported values are "matplotlib" and

custom_alpha

Alpha value(s) controlling the opacity of plot elements.

custom_colors

Colors used in the plot.

custom_hatch

Hatch value(s) controlling the hatch of plot elements.

custom_linestyles

Line styles used in the plot (This feature is not supported by all plot

custom_linewidths

Line widths used in the plot (This feature is not supported by all plot

custom_markers

Marker types used in the plot (This feature is not supported by all plot

custom_xticklabels

List of labels for the ticks on the x-axis.

custom_xticks

List of values to set ticks on the x-axis.

custom_yticklabels

List of labels for the ticks on the y-axis.

custom_yticks

List of values to set ticks on the y-axis.

data_labels

List of labels for all data sets.

equal_aspect_ratio

Set equal aspect ratio of the plot(s).

legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

legend_loc

Location of the legend. The default value is 1.

legend_ncol

Columns of the legend (only supported for the matplotlib backend).

legend_sort_entries

Sort entries of the legend.

plot_grid

Whether to draw a grid in the plot. The default value is False.

ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

show_colorbar

Show colorbar (not supported by all plots).

show_grid

Whether to draw a grid in the plot. The default value is False.

show_legend

Show legend. The default value is False.

show_plot

Show plot. The default value is False.

store_path

Path of the folder to store the plot. The default value is ./.

store_plot

Store plot. The default value is False.

style_sheet

Custom matplotlib style sheet.

subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

subplot_align_ylabels

Align y label of plot. The default value is False.

subplot_gridspec

Grid spec values.

subplot_hspace

Vertical spacing between the subplots.

subplot_ncols

Number of columns. The default value is 1.

subplot_nrows

Number of rows. The default value is 2.

subplot_share_colorbar

Use one common colorbar for all subplots.

subplot_share_legend

Merge legend items of all subplots.

subplot_sharex

Share the x-axis of subplots located in the same column.

subplot_sharey

Share the y-axis of subplots located in the same row.

subplot_sup_title

Title of the whole figure.

subplot_sup_x_label

x-label of the whole figure.

subplot_sup_y_label

y-label of the whole figure.

subplot_tight_layout

Tight layout of plot. The default value is False.

subplot_wspace

Horizontal spacing between the subplots.

x_label

Label of the x-axis. If None is given no label will be shown. The

x_range

Range of the x-axis. The default value is None.

x_unit

Set unit of the x coordinate.

y_label

Label of the y-axis. If None is given no label will be shown. The

y_range

Range of the y-axis. The default value is None.

Methods

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()

Reset gridspec settings.

return_data_labels()

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_colors

Colors used in the plot.

Type:

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 custom_xticklabels

List of labels for the ticks on the x-axis.

Type:

list

property custom_xticks

List of values to set ticks on the x-axis.

Type:

list

property custom_yticklabels

List of labels for the ticks on the y-axis.

Type:

list

property custom_yticks

List of values to set ticks on the y-axis.

Type:

list

property data_labels

List of labels for all data sets.

Type:

list

property equal_aspect_ratio

Set equal aspect ratio of the plot(s).

Type:

bool

property legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

Type:

tuple or list

property legend_loc

Location of the legend. The default value is 1.

Type:

int

property legend_ncol

Columns of the legend (only supported for the matplotlib backend).

Type:

int

property legend_sort_entries

Sort entries of the legend.

Type:

bool

property plot_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

Type:

tuple or list

property show_colorbar

Show colorbar (not supported by all plots).

Type:

bool

property show_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property show_legend

Show legend. The default value is False.

Type:

bool

property show_plot

Show plot. The default value is False.

Type:

bool

property store_path

Path of the folder to store the plot. The default value is ./.

Type:

str

property store_plot

Store plot. The default value is False.

Type:

bool

property style_sheet

Custom matplotlib style sheet.

Type:

str

property subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

Type:

dict

property subplot_align_ylabels

Align y label of plot. The default value is False.

Type:

bool

property subplot_gridspec

Grid spec values.

Type:

list or tuple

property subplot_hspace

Vertical spacing between the subplots.

Type:

float

property subplot_ncols

Number of columns. The default value is 1.

Type:

int

property subplot_nrows

Number of rows. The default value is 2.

Type:

int

property subplot_share_colorbar

Use one common colorbar for all subplots.

Type:

bool

property subplot_share_legend

Merge legend items of all subplots.

Type:

bool

property subplot_sharex

Share the x-axis of subplots located in the same column.

Type:

bool

property subplot_sharey

Share the y-axis of subplots located in the same row.

Type:

bool

property subplot_sup_title

Title of the whole figure.

Type:

str

property subplot_sup_x_label

x-label of the whole figure.

Type:

str

property subplot_sup_y_label

y-label of the whole figure.

Type:

str

property subplot_tight_layout

Tight layout of plot. The default value is False.

Type:

bool

property subplot_wspace

Horizontal spacing between the subplots.

Type:

float

property x_label

Label of the x-axis. If None is given no label will be shown. The default value is None.

Type:

str or None

property x_range

Range of the x-axis. The default value is None.

Type:

tuple or list

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 is None.

Type:

str or None

property y_range

Range of the y-axis. The default value is None.

Type:

tuple or list

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.

return_data_labels()

Return the labels of all data sets.

Returns:

data_labels (list) – List of the labels of all data sets.

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.

Variables:
show_convex_hull : bool

Whether to calculate and show the convex hull in the plot.

Overview

Properties

backend

used backend library to plot the data. Supported values are "matplotlib" and

custom_alpha

Alpha value(s) controlling the opacity of plot elements.

custom_colors

Colors used in the plot.

custom_hatch

Hatch value(s) controlling the hatch of plot elements.

custom_linestyles

Line styles used in the plot (This feature is not supported by all plot

custom_linewidths

Line widths used in the plot (This feature is not supported by all plot

custom_markers

Marker types used in the plot (This feature is not supported by all plot

custom_xticklabels

List of labels for the ticks on the x-axis.

custom_xticks

List of values to set ticks on the x-axis.

custom_yticklabels

List of labels for the ticks on the y-axis.

custom_yticks

List of values to set ticks on the y-axis.

data_labels

List of labels for all data sets.

elements

List of elements that are included in the plot. If set to None all elements

equal_aspect_ratio

Set equal aspect ratio of the plot(s).

legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

legend_loc

Location of the legend. The default value is 1.

legend_ncol

Columns of the legend (only supported for the matplotlib backend).

legend_sort_entries

Sort entries of the legend.

plot_grid

Whether to draw a grid in the plot. The default value is False.

plot_type

'formation_energy', 'stability',

ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

show_colorbar

Show colorbar (not supported by all plots).

show_crystal_system

Show crystal system of the phases.

show_grid

Whether to draw a grid in the plot. The default value is False.

show_legend

Show legend. The default value is False.

show_plot

Show plot. The default value is False.

store_path

Path of the folder to store the plot. The default value is ./.

store_plot

Store plot. The default value is False.

style_sheet

Custom matplotlib style sheet.

subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

subplot_align_ylabels

Align y label of plot. The default value is False.

subplot_gridspec

Grid spec values.

subplot_hspace

Vertical spacing between the subplots.

subplot_ncols

Number of columns. The default value is 1.

subplot_nrows

Number of rows. The default value is 2.

subplot_share_colorbar

Use one common colorbar for all subplots.

subplot_share_legend

Merge legend items of all subplots.

subplot_sharex

Share the x-axis of subplots located in the same column.

subplot_sharey

Share the y-axis of subplots located in the same row.

subplot_sup_title

Title of the whole figure.

subplot_sup_x_label

x-label of the whole figure.

subplot_sup_y_label

y-label of the whole figure.

subplot_tight_layout

Tight layout of plot. The default value is False.

subplot_wspace

Horizontal spacing between the subplots.

top_labels

Chemical formulas that are shown as labels in the plot.

x_label

Label of the x-axis. If None is given no label will be shown. The

x_range

Range of the x-axis. The default value is None.

y_label

Label of the y-axis. If None is given no label will be shown. The

y_range

Range of the y-axis. The default value is None.

Methods

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()

Reset gridspec settings.

return_data_labels()

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_colors

Colors used in the plot.

Type:

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 custom_xticklabels

List of labels for the ticks on the x-axis.

Type:

list

property custom_xticks

List of values to set ticks on the x-axis.

Type:

list

property custom_yticklabels

List of labels for the ticks on the y-axis.

Type:

list

property custom_yticks

List of values to set ticks on the y-axis.

Type:

list

property data_labels

List of labels for all data sets.

Type:

list

property elements

List of elements that are included in the plot. If set to None all elements are included.

Type:

list

property equal_aspect_ratio

Set equal aspect ratio of the plot(s).

Type:

bool

property legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

Type:

tuple or list

property legend_loc

Location of the legend. The default value is 1.

Type:

int

property legend_ncol

Columns of the legend (only supported for the matplotlib backend).

Type:

int

property legend_sort_entries

Sort entries of the legend.

Type:

bool

property plot_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

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_colorbar

Show colorbar (not supported by all plots).

Type:

bool

property show_crystal_system

Show crystal system of the phases.

property show_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property show_legend

Show legend. The default value is False.

Type:

bool

property show_plot

Show plot. The default value is False.

Type:

bool

property store_path

Path of the folder to store the plot. The default value is ./.

Type:

str

property store_plot

Store plot. The default value is False.

Type:

bool

property style_sheet

Custom matplotlib style sheet.

Type:

str

property subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

Type:

dict

property subplot_align_ylabels

Align y label of plot. The default value is False.

Type:

bool

property subplot_gridspec

Grid spec values.

Type:

list or tuple

property subplot_hspace

Vertical spacing between the subplots.

Type:

float

property subplot_ncols

Number of columns. The default value is 1.

Type:

int

property subplot_nrows

Number of rows. The default value is 2.

Type:

int

property subplot_share_colorbar

Use one common colorbar for all subplots.

Type:

bool

property subplot_share_legend

Merge legend items of all subplots.

Type:

bool

property subplot_sharex

Share the x-axis of subplots located in the same column.

Type:

bool

property subplot_sharey

Share the y-axis of subplots located in the same row.

Type:

bool

property subplot_sup_title

Title of the whole figure.

Type:

str

property subplot_sup_x_label

x-label of the whole figure.

Type:

str

property subplot_sup_y_label

y-label of the whole figure.

Type:

str

property subplot_tight_layout

Tight layout of plot. The default value is False.

Type:

bool

property subplot_wspace

Horizontal spacing between the subplots.

Type:

float

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 is None.

Type:

str or None

property x_range

Range of the x-axis. The default value is None.

Type:

tuple or list

property y_label

Label of the y-axis. If None is given no label will be shown. The default value is None.

Type:

str or None

property y_range

Range of the y-axis. The default value is None.

Type:

tuple or list

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 label data_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.

return_data_labels()

Return the labels of all data sets.

Returns:

data_labels (list) – List of the labels of all data sets.

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

Properties

backend

used backend library to plot the data. Supported values are "matplotlib" and

coordinates_unit

Set unit of the two coordinates.

custom_alpha

Alpha value(s) controlling the opacity of plot elements.

custom_colors

Colors used in the plot.

custom_hatch

Hatch value(s) controlling the hatch of plot elements.

custom_linestyles

Line styles used in the plot (This feature is not supported by all plot

custom_linewidths

Line widths used in the plot (This feature is not supported by all plot

custom_markers

Marker types used in the plot (This feature is not supported by all plot

custom_xticklabels

List of labels for the ticks on the x-axis.

custom_xticks

List of values to set ticks on the x-axis.

custom_yticklabels

List of labels for the ticks on the y-axis.

custom_yticks

List of values to set ticks on the y-axis.

data_labels

List of labels for all data sets.

equal_aspect_ratio

Set equal aspect ratio of the plot(s).

legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

legend_loc

Location of the legend. The default value is 1.

legend_ncol

Columns of the legend (only supported for the matplotlib backend).

legend_sort_entries

Sort entries of the legend.

norm

Set norm of the z-values for matplotlib.

plot_grid

Whether to draw a grid in the plot. The default value is False.

plot_type

Set plot-type.

ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

show_colorbar

Show colorbar (not supported by all plots).

show_grid

Whether to draw a grid in the plot. The default value is False.

show_legend

Show legend. The default value is False.

show_plot

Show plot. The default value is False.

store_path

Path of the folder to store the plot. The default value is ./.

store_plot

Store plot. The default value is False.

style_sheet

Custom matplotlib style sheet.

subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

subplot_align_ylabels

Align y label of plot. The default value is False.

subplot_gridspec

Grid spec values.

subplot_hspace

Vertical spacing between the subplots.

subplot_ncols

Number of columns. The default value is 1.

subplot_nrows

Number of rows. The default value is 2.

subplot_share_colorbar

Use one common colorbar for all subplots.

subplot_share_legend

Merge legend items of all subplots.

subplot_sharex

Share the x-axis of subplots located in the same column.

subplot_sharey

Share the y-axis of subplots located in the same row.

subplot_sup_title

Title of the whole figure.

subplot_sup_x_label

x-label of the whole figure.

subplot_sup_y_label

y-label of the whole figure.

subplot_tight_layout

Tight layout of plot. The default value is False.

subplot_wspace

Horizontal spacing between the subplots.

values_unit

Set unit of the z-values.

x_label

Label of the x-axis. If None is given no label will be shown. The

x_range

Range of the x-axis. The default value is None.

y_label

Label of the y-axis. If None is given no label will be shown. The

y_range

Range of the y-axis. The default value is None.

Methods

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()

Reset gridspec settings.

return_data_labels()

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_colors

Colors used in the plot.

Type:

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 custom_xticklabels

List of labels for the ticks on the x-axis.

Type:

list

property custom_xticks

List of values to set ticks on the x-axis.

Type:

list

property custom_yticklabels

List of labels for the ticks on the y-axis.

Type:

list

property custom_yticks

List of values to set ticks on the y-axis.

Type:

list

property data_labels

List of labels for all data sets.

Type:

list

property equal_aspect_ratio

Set equal aspect ratio of the plot(s).

Type:

bool

property legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

Type:

tuple or list

property legend_loc

Location of the legend. The default value is 1.

Type:

int

property legend_ncol

Columns of the legend (only supported for the matplotlib backend).

Type:

int

property legend_sort_entries

Sort entries of the legend.

Type:

bool

property norm

Set norm of the z-values for matplotlib.

property plot_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

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

property show_colorbar

Show colorbar (not supported by all plots).

Type:

bool

property show_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property show_legend

Show legend. The default value is False.

Type:

bool

property show_plot

Show plot. The default value is False.

Type:

bool

property store_path

Path of the folder to store the plot. The default value is ./.

Type:

str

property store_plot

Store plot. The default value is False.

Type:

bool

property style_sheet

Custom matplotlib style sheet.

Type:

str

property subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

Type:

dict

property subplot_align_ylabels

Align y label of plot. The default value is False.

Type:

bool

property subplot_gridspec

Grid spec values.

Type:

list or tuple

property subplot_hspace

Vertical spacing between the subplots.

Type:

float

property subplot_ncols

Number of columns. The default value is 1.

Type:

int

property subplot_nrows

Number of rows. The default value is 2.

Type:

int

property subplot_share_colorbar

Use one common colorbar for all subplots.

Type:

bool

property subplot_share_legend

Merge legend items of all subplots.

Type:

bool

property subplot_sharex

Share the x-axis of subplots located in the same column.

Type:

bool

property subplot_sharey

Share the y-axis of subplots located in the same row.

Type:

bool

property subplot_sup_title

Title of the whole figure.

Type:

str

property subplot_sup_x_label

x-label of the whole figure.

Type:

str

property subplot_sup_y_label

y-label of the whole figure.

Type:

str

property subplot_tight_layout

Tight layout of plot. The default value is False.

Type:

bool

property subplot_wspace

Horizontal spacing between the subplots.

Type:

float

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 is None.

Type:

str or None

property x_range

Range of the x-axis. The default value is None.

Type:

tuple or list

property y_label

Label of the y-axis. If None is given no label will be shown. The default value is None.

Type:

str or None

property y_range

Range of the y-axis. The default value is None.

Type:

tuple or list

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.

return_data_labels()

Return the labels of all data sets.

Returns:

data_labels (list) – List of the labels of all data sets.

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

Properties

backend

used backend library to plot the data. Supported values are "matplotlib" and

custom_alpha

Alpha value(s) controlling the opacity of plot elements.

custom_colors

Colors used in the plot.

custom_hatch

Hatch value(s) controlling the hatch of plot elements.

custom_linestyles

Line styles used in the plot (This feature is not supported by all plot

custom_linewidths

Line widths used in the plot (This feature is not supported by all plot

custom_markers

Marker types used in the plot (This feature is not supported by all plot

custom_xticklabels

List of labels for the ticks on the x-axis.

custom_xticks

List of values to set ticks on the x-axis.

custom_yticklabels

List of labels for the ticks on the y-axis.

custom_yticks

List of values to set ticks on the y-axis.

data_labels

List of labels for all data sets.

equal_aspect_ratio

Set equal aspect ratio of the plot(s).

legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

legend_loc

Location of the legend. The default value is 1.

legend_ncol

Columns of the legend (only supported for the matplotlib backend).

legend_sort_entries

Sort entries of the legend.

plot_grid

Whether to draw a grid in the plot. The default value is False.

ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

show_colorbar

Show colorbar (not supported by all plots).

show_grid

Whether to draw a grid in the plot. The default value is False.

show_legend

Show legend. The default value is False.

show_plot

Show plot. The default value is False.

store_path

Path of the folder to store the plot. The default value is ./.

store_plot

Store plot. The default value is False.

style_sheet

Custom matplotlib style sheet.

subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

subplot_align_ylabels

Align y label of plot. The default value is False.

subplot_gridspec

Grid spec values.

subplot_hspace

Vertical spacing between the subplots.

subplot_ncols

Number of columns. The default value is 1.

subplot_nrows

Number of rows. The default value is 2.

subplot_share_colorbar

Use one common colorbar for all subplots.

subplot_share_legend

Merge legend items of all subplots.

subplot_sharex

Share the x-axis of subplots located in the same column.

subplot_sharey

Share the y-axis of subplots located in the same row.

subplot_sup_title

Title of the whole figure.

subplot_sup_x_label

x-label of the whole figure.

subplot_sup_y_label

y-label of the whole figure.

subplot_tight_layout

Tight layout of plot. The default value is False.

subplot_wspace

Horizontal spacing between the subplots.

x_label

Label of the x-axis. If None is given no label will be shown. The

x_range

Range of the x-axis. The default value is None.

y_label

Label of the y-axis. If None is given no label will be shown. The

y_range

Range of the y-axis. The default value is None.

Methods

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_additional_plot_elements()

Remove all added plot elements.

reset_gridspec()

Reset gridspec settings.

return_data_labels()

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_colors

Colors used in the plot.

Type:

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 custom_xticklabels

List of labels for the ticks on the x-axis.

Type:

list

property custom_xticks

List of values to set ticks on the x-axis.

Type:

list

property custom_yticklabels

List of labels for the ticks on the y-axis.

Type:

list

property custom_yticks

List of values to set ticks on the y-axis.

Type:

list

property data_labels

List of labels for all data sets.

Type:

list

property equal_aspect_ratio

Set equal aspect ratio of the plot(s).

Type:

bool

property legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

Type:

tuple or list

property legend_loc

Location of the legend. The default value is 1.

Type:

int

property legend_ncol

Columns of the legend (only supported for the matplotlib backend).

Type:

int

property legend_sort_entries

Sort entries of the legend.

Type:

bool

property plot_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

Type:

tuple or list

property show_colorbar

Show colorbar (not supported by all plots).

Type:

bool

property show_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property show_legend

Show legend. The default value is False.

Type:

bool

property show_plot

Show plot. The default value is False.

Type:

bool

property store_path

Path of the folder to store the plot. The default value is ./.

Type:

str

property store_plot

Store plot. The default value is False.

Type:

bool

property style_sheet

Custom matplotlib style sheet.

Type:

str

property subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

Type:

dict

property subplot_align_ylabels

Align y label of plot. The default value is False.

Type:

bool

property subplot_gridspec

Grid spec values.

Type:

list or tuple

property subplot_hspace

Vertical spacing between the subplots.

Type:

float

property subplot_ncols

Number of columns. The default value is 1.

Type:

int

property subplot_nrows

Number of rows. The default value is 2.

Type:

int

property subplot_share_colorbar

Use one common colorbar for all subplots.

Type:

bool

property subplot_share_legend

Merge legend items of all subplots.

Type:

bool

property subplot_sharex

Share the x-axis of subplots located in the same column.

Type:

bool

property subplot_sharey

Share the y-axis of subplots located in the same row.

Type:

bool

property subplot_sup_title

Title of the whole figure.

Type:

str

property subplot_sup_x_label

x-label of the whole figure.

Type:

str

property subplot_sup_y_label

y-label of the whole figure.

Type:

str

property subplot_tight_layout

Tight layout of plot. The default value is False.

Type:

bool

property subplot_wspace

Horizontal spacing between the subplots.

Type:

float

property x_label

Label of the x-axis. If None is given no label will be shown. The default value is None.

Type:

str or None

property x_range

Range of the x-axis. The default value is None.

Type:

tuple or list

property y_label

Label of the y-axis. If None is given no label will be shown. The default value is None.

Type:

str or None

property y_range

Range of the y-axis. The default value is None.

Type:

tuple or list

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.

return_data_labels()

Return the labels of all data sets.

Returns:

data_labels (list) – List of the labels of all data sets.

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

Properties

backend

used backend library to plot the data. Supported values are "matplotlib" and

custom_alpha

Alpha value(s) controlling the opacity of plot elements.

custom_colors

Colors used in the plot.

custom_hatch

Hatch value(s) controlling the hatch of plot elements.

custom_linestyles

Line styles used in the plot (This feature is not supported by all plot

custom_linewidths

Line widths used in the plot (This feature is not supported by all plot

custom_markers

Marker types used in the plot (This feature is not supported by all plot

custom_xticklabels

List of labels for the ticks on the x-axis.

custom_xticks

List of values to set ticks on the x-axis.

custom_yticklabels

List of labels for the ticks on the y-axis.

custom_yticks

List of values to set ticks on the y-axis.

data_labels

List of labels for all data sets.

equal_aspect_ratio

Set equal aspect ratio of the plot(s).

legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

legend_loc

Location of the legend. The default value is 1.

legend_ncol

Columns of the legend (only supported for the matplotlib backend).

legend_sort_entries

Sort entries of the legend.

peak_color

-

peak_distance

-

peak_height

-

peak_line_style

-

peak_max_factor

-

peak_plateau_size

-

peak_prominence

-

peak_rel_height

-

peak_threshold

-

peak_width

-

peak_wlen

-

peak_y_min

-

peaks

-

plot_grid

Whether to draw a grid in the plot. The default value is False.

plot_unit_x

Set unit of x-axis.

ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

show_colorbar

Show colorbar (not supported by all plots).

show_grid

Whether to draw a grid in the plot. The default value is False.

show_legend

Show legend. The default value is False.

show_plot

Show plot. The default value is False.

smearing_delta

Spacing between two values. If set to None the original function is

smearing_method

Method used to smear out the functions. Supported options are 'gaussian' and

smearing_sigma

Sigma value of the smearing distribution.

store_path

Path of the folder to store the plot. The default value is ./.

store_plot

Store plot. The default value is False.

style_sheet

Custom matplotlib style sheet.

subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

subplot_align_ylabels

Align y label of plot. The default value is False.

subplot_gridspec

Grid spec values.

subplot_hspace

Vertical spacing between the subplots.

subplot_ncols

Number of columns. The default value is 1.

subplot_nrows

Number of rows. The default value is 2.

subplot_share_colorbar

Use one common colorbar for all subplots.

subplot_share_legend

Merge legend items of all subplots.

subplot_sharex

Share the x-axis of subplots located in the same column.

subplot_sharey

Share the y-axis of subplots located in the same row.

subplot_sup_title

Title of the whole figure.

subplot_sup_x_label

x-label of the whole figure.

subplot_sup_y_label

y-label of the whole figure.

subplot_tight_layout

Tight layout of plot. The default value is False.

subplot_wspace

Horizontal spacing between the subplots.

x_label

Label of the x-axis. If None is given no label will be shown. The

x_range

Range of the x-axis. The default value is None.

y_label

Label of the y-axis. If None is given no label will be shown. The

y_range

Range of the y-axis. The default value is None.

Methods

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_additional_plot_elements()

Remove all added plot elements.

reset_gridspec()

Reset gridspec settings.

return_data_labels()

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_colors

Colors used in the plot.

Type:

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 custom_xticklabels

List of labels for the ticks on the x-axis.

Type:

list

property custom_xticks

List of values to set ticks on the x-axis.

Type:

list

property custom_yticklabels

List of labels for the ticks on the y-axis.

Type:

list

property custom_yticks

List of values to set ticks on the y-axis.

Type:

list

property data_labels

List of labels for all data sets.

Type:

list

property equal_aspect_ratio

Set equal aspect ratio of the plot(s).

Type:

bool

property legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

Type:

tuple or list

property legend_loc

Location of the legend. The default value is 1.

Type:

int

property legend_ncol

Columns of the legend (only supported for the matplotlib backend).

Type:

int

property legend_sort_entries

Sort entries of the legend.

Type:

bool

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_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

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 show_colorbar

Show colorbar (not supported by all plots).

Type:

bool

property show_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property show_legend

Show legend. The default value is False.

Type:

bool

property show_plot

Show plot. The default value is False.

Type:

bool

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

property smearing_sigma

Sigma value of the smearing distribution.

Type:

float

property store_path

Path of the folder to store the plot. The default value is ./.

Type:

str

property store_plot

Store plot. The default value is False.

Type:

bool

property style_sheet

Custom matplotlib style sheet.

Type:

str

property subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

Type:

dict

property subplot_align_ylabels

Align y label of plot. The default value is False.

Type:

bool

property subplot_gridspec

Grid spec values.

Type:

list or tuple

property subplot_hspace

Vertical spacing between the subplots.

Type:

float

property subplot_ncols

Number of columns. The default value is 1.

Type:

int

property subplot_nrows

Number of rows. The default value is 2.

Type:

int

property subplot_share_colorbar

Use one common colorbar for all subplots.

Type:

bool

property subplot_share_legend

Merge legend items of all subplots.

Type:

bool

property subplot_sharex

Share the x-axis of subplots located in the same column.

Type:

bool

property subplot_sharey

Share the y-axis of subplots located in the same row.

Type:

bool

property subplot_sup_title

Title of the whole figure.

Type:

str

property subplot_sup_x_label

x-label of the whole figure.

Type:

str

property subplot_sup_y_label

y-label of the whole figure.

Type:

str

property subplot_tight_layout

Tight layout of plot. The default value is False.

Type:

bool

property subplot_wspace

Horizontal spacing between the subplots.

Type:

float

property x_label

Label of the x-axis. If None is given no label will be shown. The default value is None.

Type:

str or None

property x_range

Range of the x-axis. The default value is None.

Type:

tuple or list

property y_label

Label of the y-axis. If None is given no label will be shown. The default value is None.

Type:

str or None

property y_range

Range of the y-axis. The default value is None.

Type:

tuple or list

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.

return_data_labels()

Return the labels of all data sets.

Returns:

data_labels (list) – List of the labels of all data sets.

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

Properties

area_unit

Unit of the surface area.

backend

used backend library to plot the data. Supported values are "matplotlib" and

bulk_phase

Bulk phase.

custom_alpha

Alpha value(s) controlling the opacity of plot elements.

custom_colors

Colors used in the plot.

custom_hatch

Hatch value(s) controlling the hatch of plot elements.

custom_linestyles

Line styles used in the plot (This feature is not supported by all plot

custom_linewidths

Line widths used in the plot (This feature is not supported by all plot

custom_markers

Marker types used in the plot (This feature is not supported by all plot

custom_xticklabels

List of labels for the ticks on the x-axis.

custom_xticks

List of values to set ticks on the x-axis.

custom_yticklabels

List of labels for the ticks on the y-axis.

custom_yticks

List of values to set ticks on the y-axis.

data_labels

List of labels for all data sets.

elemental_phases

Elemental phases.

energy_unit

Energy unit.

equal_aspect_ratio

Set equal aspect ratio of the plot(s).

legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

legend_loc

Location of the legend. The default value is 1.

legend_ncol

Columns of the legend (only supported for the matplotlib backend).

legend_sort_entries

Sort entries of the legend.

plot_grid

Whether to draw a grid in the plot. The default value is False.

plot_properties

Properties that are plotted on the y-axis.

plot_type

Plot type. Supported options are ‘chem_potential’ or ‘excess_atoms’.

ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

show_colorbar

Show colorbar (not supported by all plots).

show_grid

Whether to draw a grid in the plot. The default value is False.

show_legend

Show legend. The default value is False.

show_plot

Show plot. The default value is False.

store_path

Path of the folder to store the plot. The default value is ./.

store_plot

Store plot. The default value is False.

style_sheet

Custom matplotlib style sheet.

subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

subplot_align_ylabels

Align y label of plot. The default value is False.

subplot_gridspec

Grid spec values.

subplot_hspace

Vertical spacing between the subplots.

subplot_ncols

Number of columns. The default value is 1.

subplot_nrows

Number of rows. The default value is 2.

subplot_share_colorbar

Use one common colorbar for all subplots.

subplot_share_legend

Merge legend items of all subplots.

subplot_sharex

Share the x-axis of subplots located in the same column.

subplot_sharey

Share the y-axis of subplots located in the same row.

subplot_sup_title

Title of the whole figure.

subplot_sup_x_label

x-label of the whole figure.

subplot_sup_y_label

y-label of the whole figure.

subplot_tight_layout

Tight layout of plot. The default value is False.

subplot_wspace

Horizontal spacing between the subplots.

x_label

Label of the x-axis. If None is given no label will be shown. The

x_range

Range of the x-axis. The default value is None.

y_label

Label of the y-axis. If None is given no label will be shown. The

y_range

Range of the y-axis. The default value is None.

Methods

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()

Reset gridspec settings.

return_data_labels()

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 area_unit

Unit of the surface area.

Type:

str

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_colors

Colors used in the plot.

Type:

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 custom_xticklabels

List of labels for the ticks on the x-axis.

Type:

list

property custom_xticks

List of values to set ticks on the x-axis.

Type:

list

property custom_yticklabels

List of labels for the ticks on the y-axis.

Type:

list

property custom_yticks

List of values to set ticks on the y-axis.

Type:

list

property data_labels

List of labels for all data sets.

Type:

list

property elemental_phases

Elemental phases.

property energy_unit

Energy unit.

Type:

str

property equal_aspect_ratio

Set equal aspect ratio of the plot(s).

Type:

bool

property legend_bbox_to_anchor

Shift between box and anchor. The default value is (1, 1).

Type:

tuple or list

property legend_loc

Location of the legend. The default value is 1.

Type:

int

property legend_ncol

Columns of the legend (only supported for the matplotlib backend).

Type:

int

property legend_sort_entries

Sort entries of the legend.

Type:

bool

property plot_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property plot_properties

Properties that are plotted on the y-axis.

Type:

str, tuple or list

property plot_type

Plot type. Supported options are ‘chem_potential’ or ‘excess_atoms’.

Type:

str

property ratio

Length-to-width ratio of the plot given as a tuple of two numbers.

Type:

tuple or list

property show_colorbar

Show colorbar (not supported by all plots).

Type:

bool

property show_grid

Whether to draw a grid in the plot. The default value is False.

Type:

bool

property show_legend

Show legend. The default value is False.

Type:

bool

property show_plot

Show plot. The default value is False.

Type:

bool

property store_path

Path of the folder to store the plot. The default value is ./.

Type:

str

property store_plot

Store plot. The default value is False.

Type:

bool

property style_sheet

Custom matplotlib style sheet.

Type:

str

property subplot_adjust

Keyword arguments for the matplotlib subplots_adjust function.

Type:

dict

property subplot_align_ylabels

Align y label of plot. The default value is False.

Type:

bool

property subplot_gridspec

Grid spec values.

Type:

list or tuple

property subplot_hspace

Vertical spacing between the subplots.

Type:

float

property subplot_ncols

Number of columns. The default value is 1.

Type:

int

property subplot_nrows

Number of rows. The default value is 2.

Type:

int

property subplot_share_colorbar

Use one common colorbar for all subplots.

Type:

bool

property subplot_share_legend

Merge legend items of all subplots.

Type:

bool

property subplot_sharex

Share the x-axis of subplots located in the same column.

Type:

bool

property subplot_sharey

Share the y-axis of subplots located in the same row.

Type:

bool

property subplot_sup_title

Title of the whole figure.

Type:

str

property subplot_sup_x_label

x-label of the whole figure.

Type:

str

property subplot_sup_y_label

y-label of the whole figure.

Type:

str

property subplot_tight_layout

Tight layout of plot. The default value is False.

Type:

bool

property subplot_wspace

Horizontal spacing between the subplots.

Type:

float

property x_label

Label of the x-axis. If None is given no label will be shown. The default value is None.

Type:

str or None

property x_range

Range of the x-axis. The default value is None.

Type:

tuple or list

property y_label

Label of the y-axis. If None is given no label will be shown. The default value is None.

Type:

str or None

property y_range

Range of the y-axis. The default value is None.

Type:

tuple or list

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'.

aim2dat.plots.BandStructure(*args, **kwargs)[source]

Depreciated band structure class.

aim2dat.plots.BandStructureDensityOfStates(*args, **kwargs)[source]

Depreciated band structure DOS class.

aim2dat.plots.DensityOfStates(*args, **kwargs)[source]

Depreciated DOS class.

aim2dat.plots.PhaseDiagram(*args, **kwargs)[source]

Depreciated PhaseDiagram class.

aim2dat.plots.Spectrum(*args, **kwargs)[source]

Depreciated Spectrum class.