简体   繁体   中英

Pandas multiple boxplots - how to reduce spacing between plots?

I have a plot with two boxplots:

在此处输入图片说明

There is an awful lot of spacing between lan_data and wan_data. I would like to reduce that spacing.

My dataframe is simply:

df = pd.DataFrame({'lan_data':random.sample(range(1, 100), 100), 'wan_data':random.sample(range(1, 100), 100)})

I have looked and all answers I come across pertain to either reducing the axis width, which just squashes the plot, or changing the position of the plots - none of those solutions appear to be appropriate.

Ideally, I'd like to be able to do something like:

df.plot.box(box_padding = [top, bottom, left, right])

or

df.plot.box(subplot_spacing = 1.5)

Any suggestions?

Try play with widths :

df.plot.box(widths=0.8)

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM