I have created a catplot for number of people killed/injured using the catplot function. However, since the scales of the 2 are very different the bars in second graphs are very small and cannot be read. Anyway I can re-scale y-axis of the second chart? And add data labels to both charts?
grid = sns.catplot(x = 'borough',
y = 'Injured/Killed',
hue = 'Commuter Type',
col = 'Injury Type',
data = tabular_breakdown,
kind = 'bar')
To solve your issue, there are two things to consider.
catplot
has as the default,sharey=True
, so whatever you changed in the second axes would reflect on the other.grid
, so no problem.To solve the first issue, pass your call with
sharey=False
. To solve the second, access the axes with something likeax0, ax1 = grid.axes[0]
, then callax1.set_ylim(<values>)
. If you don't want to specifysharey=False
, which is what I was going for initially, you're going to have to resort to the solutions here.