Skip to content

Commit

Permalink
Merge pull request #5 from anthony-wang/plotting-updates
Browse files Browse the repository at this point in the history
Small visual improvements in plotting
  • Loading branch information
anthony-wang authored Apr 17, 2021
2 parents 7436ccd + 2edf703 commit a5be06f
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ models/trained_rf/*.joblib
models/trained_models/*.pth
models/*.zip
models/*.7z


# figures/lc_data/*.png
figures/*.eps
*.npz

# Pylint code analysis stuff
Expand Down
15 changes: 12 additions & 3 deletions Paper_FIG_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,12 @@ def get_attention(attn_mat, idx=0, layer=0, head=0):
other_dict = {i: [] for i in range(1, 119)}

option = [0, 1, 2, 3, 'average']
head_option = option[0]
option_texts = ['a)', 'b)', 'c)', 'd)', 'average']

idx_plot = 0
head_option = option[idx_plot]
option_text = option_texts[idx_plot]

for idx in range(len(data_loader.dataset)):
map_data = get_attention(attn_mat, idx=idx, layer=layer, head=head_option)
atom_fracs = get_atomic_fracs(data_loader, idx=idx)
Expand Down Expand Up @@ -244,16 +249,17 @@ def plot(mat_prop, property_tracker):
color = 'silver'
if row < 3:
row += 0.5
# element box
rect = patches.Rectangle((column, row), rw, rh,
linewidth=1.5,
edgecolor='gray',
facecolor=color,
alpha=1)

# plot element text
text = plt.text(column+rw/2, row+rw/2, symbol,
horizontalalignment='center',
verticalalignment='center',
fontsize=16,
fontsize=22,
fontweight='semibold', color='white')

text.set_path_effects([path_effects.Stroke(linewidth=3,
Expand Down Expand Up @@ -300,6 +306,9 @@ def plot(mat_prop, property_tracker):
verticalalignment='center',
fontweight='semibold',
fontsize=20, color='k')
# add annotation for subfigure numbering
plt.text(0.55, n_row+.1, option_text,
fontweight='semibold', fontsize=38, color='k')
ax.set_ylim(-0.15, n_row+.1)
ax.set_xlim(0.85, n_column+1.1)

Expand Down
5 changes: 3 additions & 2 deletions Paper_FIG_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,17 @@ def plot(mat_prop, property_tracker):
color = 'silver'
if row < 3:
row += 0.5
# element box
rect = patches.Rectangle((column, row), rw, rh,
linewidth=1.5,
edgecolor='gray',
facecolor=color,
alpha=1)

# plot element text
plt.text(column+rw/2, row+rw/2, symbol,
horizontalalignment='center',
verticalalignment='center',
fontsize=20,
fontsize=22,
fontweight='semibold', color='k')

ax.add_patch(rect)
Expand Down
Binary file modified figures/Figure2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/Figure2_aflow__Egap_ptable_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/Figure2_aflow__Egap_ptable_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/Figure2_aflow__Egap_ptable_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/Figure2_aflow__Egap_ptable_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/Figure2_aflow__Egap_ptable_average.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/Figure3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed figures/binary_plot_Si-O.png
Binary file not shown.

0 comments on commit a5be06f

Please sign in to comment.