Created
December 22, 2021 04:23
-
-
Save mjhong0708/403ef57dfb7cd93dcfae8aba5286c7f5 to your computer and use it in GitHub Desktop.
Plot atoms on matplotlib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ase.io | |
from ase.visualize.plot import plot_atoms | |
import matplotlib.pyplot as plt | |
import matplotlib_inline | |
def view_atoms(atoms): | |
fig, axs = plt.subplots(nrows=1, ncols=3, facecolor="w", dpi=130) | |
axs[0].set_title("Top", fontfamily="Arial", fontsize=16, fontweight="bold") | |
axs[1].set_title("Side", fontfamily="Arial", fontsize=16, fontweight="bold") | |
axs[2].set_title("Rotated", fontfamily="Arial", fontsize=16, fontweight="bold") | |
plot_atoms(atoms, axs[0], radii=0.5, rotation=('0x,0y,180z')) | |
plot_atoms(atoms, axs[1], radii=0.5, rotation=('90x,90y,180z')) | |
plot_atoms(atoms, axs[2], radii=0.5, rotation=('90x,45y,180z')) | |
for ax in axs: | |
for sp in ax.spines.values(): | |
sp.set_visible(False) | |
ax.set_xticks([]) | |
ax.set_yticks([]) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment