Skip to content

Commit cb738f0

Browse files
committed
Correct placement of colorbar.
1 parent f3c3afd commit cb738f0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

axelrod/plot.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def _violinplot(
6767
ax.tick_params(axis='both', which='both', labelsize=8)
6868
if title:
6969
ax.set_title(title)
70+
plt.tight_layout()
7071
return figure
7172

7273
# Box and Violin plots for mean score, score differences, wins, and match
@@ -204,10 +205,8 @@ def _payoff_heatmap(
204205
ax.tick_params(axis='both', which='both', labelsize=16)
205206
if title:
206207
ax.set_xlabel(title)
207-
# Make the colorbar match up with the plot
208-
divider = make_axes_locatable(plt.gca())
209-
cax = divider.append_axes("right", "5%", pad="3%")
210-
plt.colorbar(mat, cax=cax, ax=ax)
208+
figure.colorbar(mat, ax=ax)
209+
plt.tight_layout()
211210
return figure
212211

213212
def pdplot(
@@ -278,6 +277,7 @@ def stackplot(
278277
if logscale:
279278
ax.set_xscale('log')
280279

280+
plt.tight_layout()
281281
return figure
282282

283283
def save_all_plots(

0 commit comments

Comments
 (0)