pymatgen.phasediagram.plotter module¶

class
PDPlotter
(phasediagram, show_unstable=0)[source]¶ Bases:
object
A plotter class for phase diagrams.
Parameters:  phasediagram – PhaseDiagram object.
 show_unstable (float) – Whether unstable phases will be plotted as well as red crosses. If a number > 0 is entered, all phases with ehull < show_unstable will be shown.

get_chempot_range_map_plot
(elements, referenced=True)[source]¶ Returns a plot of the chemical potential range _map. Currently works only for 3component PDs.
Parameters:  elements – Sequence of elements to be considered as independent variables. E.g., if you want to show the stability ranges of all LiCoO phases wrt to uLi and uO, you will supply [Element(“Li”), Element(“O”)]
 referenced – if True, gives the results with a reference being the energy of the elemental phase. If False, gives absolute values.
Returns: A matplotlib plot object.

get_contour_pd_plot
()[source]¶ Plot a contour phase diagram plot, where phase triangles are colored according to degree of instability by interpolation. Currently only works for 3component phase diagrams.
Returns: A matplotlib plot object.

get_plot
(label_stable=True, label_unstable=True, ordering=None, energy_colormap=None, process_attributes=False)[source]¶

pd_plot_data
¶ Plot data for phase diagram. 2comp  Full hull with energies 3/4comp  Projection into 2D or 3D Gibbs triangle.
Returns:  lines is a list of list of coordinates for lines in the PD.
 stable_entries is a {coordinate : entry} for each stable node
in the phase diagram. (Each coordinate can only have one stable phase)  unstable_entries is a {entry: coordinates} for all unstable nodes in the phase diagram.
Return type: (lines, stable_entries, unstable_entries)

plot_chempot_range_map
(elements, referenced=True)[source]¶ Plot the chemical potential range _map. Currently works only for 3component PDs.
Parameters:  elements – Sequence of elements to be considered as independent variables. E.g., if you want to show the stability ranges of all LiCoO phases wrt to uLi and uO, you will supply [Element(“Li”), Element(“O”)]
 referenced – if True, gives the results with a reference being the energy of the elemental phase. If False, gives absolute values.

show
(*args, **kwargs)[source]¶ Draws the phase diagram using Matplotlib and show it.
Parameters:  *args – Passed to get_plot.
 **kwargs – Passed to get_plot.

write_image
(stream, image_format='svg', label_stable=True, label_unstable=True, ordering=None, energy_colormap=None, process_attributes=False)[source]¶ Writes the phase diagram to an image in a stream.
Parameters:  stream – stream to write to. Can be a file stream or a StringIO stream.
 image_format – format for image. Can be any of matplotlib supported formats. Defaults to svg for best results for vector graphics.

order_phase_diagram
(lines, stable_entries, unstable_entries, ordering)[source]¶ Orders the entries (their coordinates) in a phase diagram plot according to the user specified ordering. Ordering should be given as [‘Up’, ‘Left’, ‘Right’], where Up, Left and Right are the names of the entries in the upper, left and right corners of the triangle respectively.
Parameters:  lines – list of list of coordinates for lines in the PD.
 stable_entries – {coordinate : entry} for each stable node in the phase diagram. (Each coordinate can only have one stable phase)
 unstable_entries – {entry: coordinates} for all unstable nodes in the phase diagram.
 ordering – Ordering of the phase diagram, given as a list [‘Up’, ‘Left’,’Right’]
Returns:  newlines is a list of list of coordinates for lines in the PD.
 newstable_entries is a {coordinate : entry} for each stable node
in the phase diagram. (Each coordinate can only have one stable phase)  newunstable_entries is a {entry: coordinates} for all unstable nodes in the phase diagram.
Return type: (newlines, newstable_entries, newunstable_entries)

tet_coord
(coord)[source]¶ Convert a 3D coordinate into a tetrahedron based coordinate system for a prettier phase diagram.
Parameters: coordinate – coordinate used in the convex hull computation. Returns: coordinates in a tetrahedronbased coordinate system.

triangular_coord
(coord)[source]¶ Convert a 2D coordinate into a trianglebased coordinate system for a prettier phase diagram.
Parameters: coordinate – coordinate used in the convex hull computation. Returns: coordinates in a triangularbased coordinate system.

uniquelines
(q)[source]¶ Given all the facets, convert it into a set of unique lines. Specifically used for converting convex hull facets into line pairs of coordinates.
Parameters: q – A 2dim sequence, where each row represents a facet. E.g., [[1,2,3],[3,6,7],...] Returns: A set of tuple of lines. E.g., ((1,2), (1,3), (2,3), ....) Return type: setoflines