Skip to content

Commit

Permalink
slightly better plot formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
eruijsena committed Oct 9, 2023
1 parent ee7a380 commit d93e0fd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions reeds/function_libs/visualization/re_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ def plot_exchange_prob_per_state(s_values:List[float], exchange_freq:Dict[int,Li

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

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

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

# Create big subplot for common label
Expand Down

0 comments on commit d93e0fd

Please sign in to comment.