Shi*_*Dua 3 python matplotlib seaborn jupyter-notebook
我想画一些虚线。我怎样才能做到这一点?我尝试以 2 种不同的方式使用 linestyle 并出现错误
#### approach 1
for x, m in x_list:
sns.distplot(x, hist=False, label=m, linestyle='--')
#### approach 2
for x, m in x_list:
sns.distplot(x, hist=False, label=m, kde_kws={'linestyle':'--'})
TypeError: distplot() got an unexpected keyword argument 'linestyle'
Run Code Online (Sandbox Code Playgroud)
使用的第二种方法kde_kws={'linestyle':'--'}适用于 seaborn 8.1。也许你想更新。
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
x_list = [np.random.rayleigh(1+i/2., size=35) for i in range(4)]
for x in x_list:
sns.distplot(x, hist=False, kde_kws={'linestyle':'--'})
plt.show()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4412 次 |
| 最近记录: |