我对Matplotlib不熟悉,学习如何在Python中绘制箱线图时,我想知道是否有一种方法可以在箱线图中显示均值? 以下是我的代码...
from pylab import *
import matplotlib.pyplot as plt
data1=np.random.rand(100,1)
data2=np.random.rand(100,1)
data_to_plot=[data1,data2]
#Create a figure instance
fig = plt.figure(1, figsize=(9, 6))
# Create an axes instance
axes = fig.add_subplot(111)
# Create the boxplot
bp = axes.boxplot(data_to_plot,**showmeans=True**)
尽管我已经打开了showmean标志,但它仍然给出以下错误。
TypeError: boxplot() got an unexpected keyword argument 'showmeans'
data1
,data2
,ax
)。请看看我回答中的代码在你这边是否可行。 - hitzg