Skip to content

Commit 96bd023

Browse files
committed
chore: add comment
1 parent 1d9469e commit 96bd023

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

utils/plot.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def plot_rdf(material: "Material", cutoff: float = 10.0, bin_size: float = 0.1)
7979
"""
8080
is_pyodide = sys.platform == "emscripten"
8181
if is_pyodide:
82+
# This is needed so that plt is adjusted before import to work in Pyodide environment
8283
plt.switch_backend("Agg")
8384

8485
rdf = RadialDistributionFunction.from_material(material, cutoff=cutoff, bin_size=bin_size)
@@ -87,6 +88,7 @@ def plot_rdf(material: "Material", cutoff: float = 10.0, bin_size: float = 0.1)
8788
)
8889

8990
if is_pyodide:
91+
# Necessary to display the plot in Pyodide environment
9092
buf = io.BytesIO()
9193
plt.savefig(buf, format="png")
9294
buf.seek(0)

0 commit comments

Comments
 (0)