我有一个值列表,我想为其绘制分布。我正在使用箱线图,但最好添加一些从箱线图四分位数到轴的虚线。我还想要 x 刻度上显示的四分位数。这是一个粗略的想法,但最后是值而不是名称。
import numpy as np
import pandas as pd
import matplotlib.pylab as plt
vel_arr = np.random.rand(1000,1)
fig = plt.figure(1, figsize=(9, 6))
ax = fig.add_subplot(111)
# Create the boxplot
ax.boxplot(vel_arr,vert=False, manage_ticks=True)
ax.set_xlabel('value')
plt.yticks([1], ['category'])
plt.show()