aim2dat.plots.phase
¶
Module plotting quantities with respect to the chemical composition.
Module Contents¶
Classes¶
Plot the formation energy of binary and ternary material systems. |
Functions¶
|
Depreciated PhaseDiagram class. |
-
class aim2dat.plots.phase.PhasePlot(plot_type=
'scatter'
, plot_property='formation_energy'
, show_crystal_system=False
, show_convex_hull=True
, show_lower_hull=False
, show_upper_hull=False
, top_labels=[]
, hist_bin_size=0.1
, **kwargs)[source]¶ Bases:
aim2dat.plots.base_plot._BasePlot
Plot the formation energy of binary and ternary material systems.
Overview
¶ used backend library to plot the data. Supported values are
"matplotlib"
andAlpha value(s) controlling the opacity of plot elements.
Colors used in the plot.
Hatch value(s) controlling the hatch of plot elements.
Line styles used in the plot (This feature is not supported by all plot
Line widths used in the plot (This feature is not supported by all plot
Marker types used in the plot (This feature is not supported by all plot
List of labels for the ticks on the x-axis.
List of values to set ticks on the x-axis.
List of labels for the ticks on the y-axis.
List of values to set ticks on the y-axis.
List of labels for all data sets.
List of elements that are included in the plot. If set to
None
all elementsSet equal aspect ratio of the plot(s).
Shift between box and anchor. The default value is
(1, 1)
.Location of the legend. The default value is
1
.Columns of the legend (only supported for the matplotlib backend).
Sort entries of the legend.
Whether to draw a grid in the plot. The default value is
False
.'formation_energy'
,'stability'
,Length-to-width ratio of the plot given as a tuple of two numbers.
Show colorbar (not supported by all plots).
Show crystal system of the phases.
Whether to draw a grid in the plot. The default value is
False
.Show legend. The default value is
False
.Show plot. The default value is
False
.Path of the folder to store the plot. The default value is
./
.Store plot. The default value is
False
.Custom matplotlib style sheet.
Keyword arguments for the matplotlib
subplots_adjust
function.Align y label of plot. The default value is
False
.Grid spec values.
Vertical spacing between the subplots.
Number of columns. The default value is
1
.Number of rows. The default value is
2
.Use one common colorbar for all subplots.
Merge legend items of all subplots.
Share the x-axis of subplots located in the same column.
Share the y-axis of subplots located in the same row.
Title of the whole figure.
x-label of the whole figure.
y-label of the whole figure.
Tight layout of plot. The default value is
False
.Horizontal spacing between the subplots.
Chemical formulas that are shown as labels in the plot.
Label of the x-axis. If
None
is given no label will be shown. TheRange of the x-axis. The default value is
None
.Label of the y-axis. If
None
is given no label will be shown. TheRange of the y-axis. The default value is
None
.¶ add_data_point
(data_label, formula, formation_energy, stability, unit, space_group, attributes)Add datapoint to the dataset.
auto_set_axis_properties
(set_x_label, set_y_label)Whether the axis labels and other axis properties are auto-generated.
create_default_gridspec
(nrows, ncols, nplots, heights, widths, center_last_row)Create default grid for multiple plots.
import_from_pandas_df
(data_label, data_frame, structure_column)Import data from pandas data frame.
import_from_structure_collection
(data_label, structure_collection)Import data from a StructureCollection object.
plot
(data_labels, plot_title, plot_name, subplot_assignment)Plot the data sets.
Reset gridspec settings.
Return the labels of all data sets.
- property backend¶
used backend library to plot the data. Supported values are
"matplotlib"
and"plotly"
.- Type:¶
str
- property custom_alpha¶
Alpha value(s) controlling the opacity of plot elements.
- Type:¶
float, list or tuple
- property custom_hatch¶
Hatch value(s) controlling the hatch of plot elements.
- Type:¶
float, list or tuple
- property custom_linestyles¶
Line styles used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_linewidths¶
Line widths used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property custom_markers¶
Marker types used in the plot (This feature is not supported by all plot types).
- Type:¶
list or tuple
- property elements¶
List of elements that are included in the plot. If set to
None
all elements are included.- Type:¶
list
- property legend_bbox_to_anchor¶
Shift between box and anchor. The default value is
(1, 1)
.- Type:¶
tuple or list
- property plot_type¶
'formation_energy'
,'stability'
,'band_gap'
,'direct_band_gap'
and'numbers'
.- Type:¶
Specify plot type. Supported options are
- property ratio¶
Length-to-width ratio of the plot given as a tuple of two numbers.
- Type:¶
tuple or list
- property show_crystal_system¶
Show crystal system of the phases.
Use one common colorbar for all subplots.
bool
Merge legend items of all subplots.
bool
Share the x-axis of subplots located in the same column.
bool
Share the y-axis of subplots located in the same row.
bool
- property top_labels¶
Chemical formulas that are shown as labels in the plot.
- Type:¶
list or str or dict
- property x_label¶
Label of the x-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
- property y_label¶
Label of the y-axis. If
None
is given no label will be shown. The default value isNone
.- Type:¶
str or None
-
add_data_point(data_label, formula, formation_energy=
None
, stability=None
, unit=None
, space_group=None
, attributes=None
)[source]¶ Add datapoint to the dataset.
If the
data_label
does not exist, a new data set with labeldata_label
is created.- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
formula (dict) – Chemical formula of the material, e.g.
{'Cs': 1, 'Sb': 2}
.formation_energy (float (optional)) – Formation energy of the material.
stability (float (optional)) – Stability of the material.
unit (str (optional)) – Unit of the formation energy and stability.
space_group (str or int (optional)) – Space group of the material, as symbol or number. The default value is
None
.attributes (dict (optional)) – Additional attributes of the material that can be plotted.
-
auto_set_axis_properties(set_x_label=
True
, set_y_label=True
)¶ Whether the axis labels and other axis properties are auto-generated.
- Parameters:¶
set_x_label (bool) – Set x-axis label automatically.
set_y_label (bool) – Set y-axis label automatically.
-
create_default_gridspec(nrows, ncols, nplots, heights=
1
, widths=1
, center_last_row=True
)¶ Create default grid for multiple plots.
- Parameters:¶
nrows (Int) – Number of rows.
ncols (int) – Number columns.
nplots (int) – Number of subplots.
heights (int (optional)) – Height of subplots.
widths (int (optional)) – Width of subplots.
center_last_row (bool (optional)) – Center the plots of the last row.
-
import_from_pandas_df(data_label, data_frame, structure_column=
'optimized_structure'
)[source]¶ Import data from pandas data frame.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
data_frame (pandas.DataFrame) – Pandas data frame containing the total energy or formation energy and the structural details.
structure_column (str (optional)) – Column containing AiiDA structure nodes used to determine structural and compositional properties. The default value is
'optimized_structure'
.
- import_from_structure_collection(data_label, structure_collection)[source]¶
Import data from a StructureCollection object.
- Parameters:¶
data_label (str) – Internal label used to plot and compare multiple data sets.
structure_collection (aim2dat.strct.StructureCollection) – Instance of StructureCollection containing all structures.
-
plot(data_labels, plot_title=
None
, plot_name='plot.png'
, subplot_assignment=None
)¶ Plot the data sets.
- Parameters:¶
data_labels (list or str) – List of data labels of the data sets that are plotted or in case only one data set is plotted a string.
plot_title (list or str (optional)) – Title of the plots or subplots.
plot_name (str (optional)) – The file name of the plot.
subplot_assignment (list or None (optional)) – Assignment of the data sets to individual subplots.
- Returns:¶
fig (matplotlib.pyplot.figure or plotly.graph_objects.Figure) – Figure object of the plot.
- reset_gridspec()¶
Reset gridspec settings.