airsspy.analysis.hull#

Tools for constructing and visualising convex hulls (phase diagrams).

Provides a Plotly-based phase diagram plotter extending pymatgen’s PDPlotter, and helper functions for ternary plot configuration.

Module Contents#

Classes#

PlotlyPDPlotter

An extension of PDPlotter for plotting phase diagrams with Plotly.

Functions#

make_axis

Create axis configuration for a ternary plot.

entry_type

Return the type label of a phase diagram entry.

entry_name

Return the name of a phase diagram entry.

API#

airsspy.analysis.hull.make_axis(title: str, tickangle: float) dict[source]#

Create axis configuration for a ternary plot.

airsspy.analysis.hull.entry_type(entry, default: str = 'Default') str[source]#

Return the type label of a phase diagram entry.

airsspy.analysis.hull.entry_name(entry, default: str = 'None') str[source]#

Return the name of a phase diagram entry.

class airsspy.analysis.hull.PlotlyPDPlotter(phasediagram: pymatgen.analysis.phase_diagram.PhaseDiagram, show_unstable: float = 0.2, backend: Literal[plotly, matplotlib]='plotly', ternary_style: Literal[2d, 3d]='2d', **plotkwargs)[source]#

Bases: pymatgen.analysis.phase_diagram.PDPlotter

An extension of PDPlotter for plotting phase diagrams with Plotly.

This may only work with old pymatgen versions that do not have native Plotly backend support.

Initialization

Args: phasediagram (PhaseDiagram): PhaseDiagram object (must be 1-4 components). show_unstable (float): Whether unstable (above the hull) phases will be plotted. If a number > 0 is entered, all phases with e_hull < show_unstable (eV/atom) will be shown. backend (“plotly” | “matplotlib”): Python package to use for plotting. Defaults to “plotly”. ternary_style (“2d” | “3d”): Ternary phase diagrams are typically plotted in two-dimensions (2d), but can be plotted in three dimensions (3d) to visualize the depth of the hull. This argument only applies when backend=”plotly”. Defaults to “2d”. **plotkwargs (dict): Keyword args passed to matplotlib.pyplot.plot (only applies when backend=”matplotlib”). Can be used to customize markers etc. If not set, the default is: { “markerfacecolor”: “#4daf4a”, “markersize”: 10, “linewidth”: 3 }.

property pd_plot_data_ternary#

Get the plot data for native ternary plot.

Returns: (lines, stable_entries, unstable_entries): Same as pd_plot_data, but in proper ternary coordinates.