有没有办法将pandas箱线图中的whiskers linestyle更改为“-”? 默认似乎是“--”。
我尝试过:
color = dict(boxes='black', whiskers='black', medians='red', caps='black')
styles=dict(whiskers='-')
bp = df.plot.box(color=color, style=styles)
然而,虽然颜色符合我的要求,但样式输入似乎并没有影响图表的呈现。
我还尝试过
boxprops = dict(linewidth=1.0, color='black')
whiskerprops = dict(linestyle='-',linewidth=1.0, color='black')
plt.figure()
df.boxplot(boxprops=boxprops, whiskerprops=whiskerprops)
在这里,df.boxplot根本不接受输入。
这与Pandas boxplot: set color and properties for box, median, mean密切相关。
import seaborn as sns tips = sns.load_dataset('tips') tips.boxplot('tip', whiskerprops = dict(linestyle='-',linewidth=4.0, color='black'))
- Ted Petrou