2014-07-10 20 views
0

我有5個獨立的基因。每個基因都有一組相關的點。因此,我決定製作一個盒子和鬍鬚圖來比較基因之間的這些不同點。但是,對於每個基因,有一個與之相關的特殊價值。我們稱之爲基因的年齡。我想要想象這個年齡值如何與每個基因的其他點相比較。年齡是否高於所有的分數?降低? Smack在中間輕拍?我如何用matplotlib做到這一點?Matplotlib框和晶須點

回答

1

您可以在同一軸線上製作一個年齡爲boxplotplot

import matplotlib.pyplot as plt 
import numpy as np 

# fake date 
genes = 10*np.random.rand(10,5) 
age = 10*np.random.rand(5) 

# plot the data 
plt.boxplot(genes) 
h, = plt.plot(range(1,6),age,'go',ms=15) # used a large marker size so these points show up. 

# add a legend 
plt.legend([h],['age'],numpoints=1) 

plt.show() 

example boxplot

+0

偉大的答案,@Molly。非常感謝您的幫助! – indiaash524