1

I have a dataframe df

df=pd.DataFrame(data=[[100,23,1],[112,13,1],[212,3,2],[222,2,2]],columns=['A','B','C'])

I plot the boxplot using groupby

axes = df.boxplot(by='C', return_type='axes')

The problem is that I would like to scale the axis of my subplots in order to center the boxplots..

I tried with

describe = df.groupby('C').describe()

idx1=0
for ax in axes:
    ax.set_ylim(describe[axes.index[idx1]]['min'].min(),describe[axes.index[idx1]]['max'].max())
    idx1 = idx1 +1

but no luck

gabboshow
  • 5,359
  • 12
  • 48
  • 98
  • You have two box plots per subplot, the look centered to me. Can you show what you want with a pic? – Scott Boston Mar 08 '18 at 18:38
  • column A is of the order of 100 while column B is of the order of 10... I would like to have separate y axes for each of the subplot... for column A something like [80 120] for column B something like [0 20] – gabboshow Mar 08 '18 at 19:10

0 Answers0