有没有办法只用Seaborn绘制Python中熊猫系列的CDF+累积直方图?我有以下资料:
import numpy as np
import pandas as pd
import seaborn as sns
s = pd.Series(np.random.normal(size=1000))
我知道我可以用s.hist(cumulative=True, normed=1)
绘制累积直方图,然后我可以用sns.kdeplot(s, cumulative=True)
绘制CDF,但是我希望在Seaborn中两者都能做,就像用sns.distplot(s)
绘制分布时一样,这样既可以得到kde拟合,也可以得到直方图。有办法吗?
通过使用
cumulative=True
和density=True
,可以使用matplotlib获得几乎相同的绘图。plt.hist(x,cumulative=True, density=True, bins=30)
相关问题 更多 >
编程相关推荐