widths : array-like, default = 0.5
Either a scalar or a vector and sets the width of each box. The default is 0.5, or 0.15*(distance between extreme positions) if that is smaller.
例子:
import numpy as np
import matplotlib.pyplot as plt
937)
np.random.seed(= np.random.lognormal(size=(37, 4), mean=1.5, sigma=1.75)
data = list('ABCD')
labels = 10 # fontsize
fs
=labels, showfliers=False, widths=(1, 0.5, 1.2, 0.1))
plt.boxplot(data, labels
plt.show()
原文:https://stackoverflow.com/questions/32443803/adjust-width-of-box-in-boxplot-in-python-matplotlib