Skip to content

Commit d93e0fd

Browse files
committed
slightly better plot formatting
1 parent ee7a380 commit d93e0fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

reeds/function_libs/visualization/re_plots.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ def plot_exchange_prob_per_state(s_values:List[float], exchange_freq:Dict[int,Li
631631

632632
for (state, freq), color, ax in zip(exchange_freq.items(), colors, axes.flatten()):
633633
freq = np.append(freq, 0)
634-
plt.grid(axis='y', lw = 1, ls = 'dashed')
634+
ax.grid(axis='y', lw = 1, ls = 'dashed')
635635
ax.set_axisbelow(True)
636636

637637
ax.bar(x, freq, width=0.45, color=color, edgecolor = 'black', alpha = 0.7)
@@ -646,11 +646,11 @@ def plot_exchange_prob_per_state(s_values:List[float], exchange_freq:Dict[int,Li
646646
# Add ticks on last row
647647
labels = []
648648
for i in range(len(s_values)):
649-
labels.append(str(s_values[i]))
649+
labels.append('{:.5f}'.format(s_values[i]))
650650
for i in range(1, 4):
651651
axes.flatten()[-i].set_xticks((x-0.5)[::2])
652652
axes.flatten()[-i].set_xticklabels(labels[::2], fontsize = 10)
653-
plt.setp(axes.flatten()[-i].get_xticklabels(), rotation=45, ha="right",
653+
plt.setp(axes.flatten()[-i].get_xticklabels(), rotation=55, ha="right",
654654
rotation_mode="anchor")
655655

656656
# Remove unused plots
@@ -661,7 +661,7 @@ def plot_exchange_prob_per_state(s_values:List[float], exchange_freq:Dict[int,Li
661661
if num_states > 3:
662662
axes.flatten()[-i-3].set_xticks((x-0.5)[::2])
663663
axes.flatten()[-i-3].set_xticklabels(labels[::2], fontsize = 10)
664-
plt.setp(axes.flatten()[-i-3].get_xticklabels(), rotation=45, ha="right",
664+
plt.setp(axes.flatten()[-i-3].get_xticklabels(), rotation=55, ha="right",
665665
rotation_mode="anchor")
666666

667667
# Create big subplot for common label

0 commit comments

Comments
 (0)