[英]Python categorical plot with error bands
我需要繪制以下數據的圖,x 軸為 year_week,y 軸為 test_duration,每個運算符作為不同的系列。 同一運營商在一周內可能有多個數據點。 我需要在每個系列周圍顯示標准偏差帶。
data = pd.DataFrame({'year_week':[1601,1602,1603,1604,1604,1604],
'operator':['jones','jack','john','jones','jones','jack'],
'test_duration':[10,12,43,7,23,9]})
打印為:
我查看了 seaborn、matplotlib 和 pandas,但找不到解決方案。
可能是您正在尋找 seabornpointplot
。
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
data = pd.DataFrame({'year_week':[1601,1602,1603,1604,1604,1604],
'operator':['jones','jack','john','jones','jones','jack'],
'test_duration':[10,12,43,7,23,9]})
sns.pointplot(x="year_week", y="test_duration", hue="operator", data=data)
plt.show()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.