Hi,
I am trying to write_image from PdPlotter. Whole code (below) is running okay except the last line.
#########################
from pymatgen.entries.compatibility import MaterialsProjectCompatibility
from pymatgen.analysis.phase_diagram import PhaseDiagram, PDPlotter
drone = VaspToComputedEntryDrone()
queen = BorgQueen(drone, rootpath=".")
entries = queen.get_data()
with MPRester() as m:
mp_entries = m.get_entries_in_chemsys([“Li”, “Fe”, “O”])
entries.extend(mp_entries)
compat = MaterialsProjectCompatibility()
entries = compat.process_entries(entries)
pd = PhaseDiagram(entries)
plotter = PDPlotter(pd)
plotter.write_image(‘test.png’, ‘png’) ### save figure
#############################
I am getting the following error…
Traceback (most recent call last):
File “example_3.py”, line 37, in
plotter.write_image(‘test.png’, ‘png’)
File “python/python-3.10.2/lib/python3.10/site-packages/pymatgen/analysis/phase_diagram.py”, line 2184, in write_image
f = plt.gcf()
AttributeError: ‘Figure’ object has no attribute ‘gcf’
Can someone help me with this error ? I don’t have Jupyter notebook installed on HPC, and only have the option to run pymatgen with python. How can I save the png file? Is there any other way?