Skip to content

make ase.io.matplotlib for exporting atoms plot to matplot subplots

As discussed in https://gitlab.com/ase/ase/issues/30, being able to export an atoms projection to a matplotlib subplot would be very nice. Since this would allow for a high degree of customization of atomic structure plots.

So I based the matplotlib "writer" of the ase.io.eps file writer, since it had all the basic features I was looking for.

This is still a very early implementation, so lacking things like doc-string, tests and documentation.

The following code can be used to test the function:

import matplotlib.pyplot as plt
from ase.io.matplotlib import write_matplotlib
from ase.lattice.cubic import FaceCenteredCubic

radii = 0.3
size = (4,4,4)

fig, ax = plt.subplots(figsize=(5,5))

slab = FaceCenteredCubic('Au', size=size)
write_matplotlib(slab, ax, radii=radii, rotation=('45x,45y,90z'))

fig.tight_layout(pad=0.0,w_pad=0.0,h_pad=0.0)
fig.savefig("test.jpg", dpi=300)
Edited by username-removed-276983

Merge request reports