Skip to content

Commit

Permalink
Merge pull request dbolya#3 from hyperparameters/master
Browse files Browse the repository at this point in the history
Fixes dbolya#2: when plotting, pad the pie chart if the summary bars have negative padding.
  • Loading branch information
dbolya authored Aug 28, 2020
2 parents 898fc49 + 7fc541d commit 5bc3034
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions tidecv/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,24 @@ def make_summary_plot(self, out_dir:str, errors:dict, model_name:str, rec_type:s
hbar_im = np.concatenate([np.zeros((vbar_im.shape[0] - hbar_im.shape[0], hbar_im.shape[1], 3)) + 255, hbar_im],
axis=0)
summary_im = np.concatenate([hbar_im, vbar_im], axis=1)

lpad, rpad = int(np.ceil((pie_im.shape[1] - summary_im.shape[1])/2)), \

# pad summary_im
if summary_im.shape[1]<pie_im.shape[1]:
lpad, rpad = int(np.ceil((pie_im.shape[1] - summary_im.shape[1])/2)), \
int(np.floor((pie_im.shape[1] - summary_im.shape[1])/2))
summary_im = np.concatenate([np.zeros((summary_im.shape[0], lpad, 3)) + 255,
summary_im = np.concatenate([np.zeros((summary_im.shape[0], lpad, 3)) + 255,
summary_im,
np.zeros((summary_im.shape[0], rpad, 3)) + 255], axis=1)

# pad pie_im
else:
lpad, rpad = int(np.ceil((summary_im.shape[1] - pie_im.shape[1])/2)), \
int(np.floor((summary_im.shape[1] - pie_im.shape[1])/2))
pie_im = np.concatenate([np.zeros((pie_im.shape[0], lpad, 3)) + 255,
pie_im,
np.zeros((pie_im.shape[0], rpad, 3)) + 255], axis=1)


summary_im = np.concatenate([pie_im, summary_im], axis=0)

if out_dir is None:
Expand Down

0 comments on commit 5bc3034

Please sign in to comment.