Skip to content

Commit 8f779f3

Browse files
committed
update calc of figure size (inculde last commit:100c317), fixed #2
1 parent 100c317 commit 8f779f3

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

dotplot/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
class DotPlot(object):
1313
DEFAULT_ITEM_HEIGHT = 0.3
14-
DEFAULT_ITEM_WIDTH = 0.35
15-
DEFAULT_LEGENDS_WIDTH = .5
14+
DEFAULT_ITEM_WIDTH = 0.3
15+
DEFAULT_LEGENDS_WIDTH = .45
1616
MIN_FIGURE_HEIGHT = 3
1717

1818
def __init__(self, df_size: pd.DataFrame,
@@ -42,11 +42,11 @@ def __get_figure(self):
4242
figure_width = mainplot_width + self.DEFAULT_LEGENDS_WIDTH
4343
plt.style.use('seaborn-white')
4444
fig = plt.figure(figsize=(figure_width, figure_height))
45-
gs = gridspec.GridSpec(nrows=2, ncols=2, wspace=0.15, hspace=0.15,
45+
gs = gridspec.GridSpec(nrows=3, ncols=2, wspace=0.15, hspace=0.15,
4646
width_ratios=[mainplot_width, self.DEFAULT_LEGENDS_WIDTH])
4747
ax = fig.add_subplot(gs[:, 0])
48-
ax_cbar = fig.add_subplot(gs[1, 1])
49-
ax_legend = fig.add_subplot(gs[0, 1])
48+
ax_cbar = fig.add_subplot(gs[2, 1])
49+
ax_legend = fig.add_subplot(gs[0:2, 1])
5050
return ax, ax_cbar, ax_legend, fig
5151

5252
@classmethod

0 commit comments

Comments
 (0)