datasciencecampus/synthgauge

Can't change colour of crosstab

cwthom opened this issue · 1 comments

Hi there,

I recently used synthgauge as part of a gov hackathon, and thought it was fantastic - really useful package! Came across one small bug, where I couldn't change the colour of a crosstab plot, because the colorbar didn't reflect the update. I was passing in eg. cmap='Blues' to the plot_crosstab method, and as per the docs it passed through to sns.heatmap, but not to the colorbar alongside the plot. I think the key lines are these, where the fig.colorbar call can't be modified:

sns.heatmap(freq_real, ax=axes[0], vmin=vmin, vmax=vmax, cbar=False,
**kwargs)
axes[0].set_title('REAL')
sns.heatmap(freq_synth, ax=axes[1], vmin=vmin, vmax=vmax, cbar=False,
**kwargs)
axes[1].set_title('SYNTH')
fig.colorbar(mpbl, ax=axes, shrink=0.8)
return fig

Simplest solution would probably be to just have cmap exposed as an argument with a default setting, but I guess you could also check if cmap is passed as part of kwargs and add it into the fig.colorbar call if so?

Thanks again for the great package!

@cwthom - Many thanks for flagging this, and for the kind words about the package. We'll take a look.