2017-03-20 13 views
1

sns.pointplot()でパレットを使用すると、join=Trueを設定しても線が表示されないか、任意の線種を選択してもパレットの色があります。それはそうなのでしょうか?または、ポイントを接続するために設定できる他のパラメータはありますか?ラインは1色にすることができます。パレットが設定されているときに点線が表示されない

答えて

1

1つは、パレットを使用してエラーバーとポイントを表示し、もう1つは接続線(パレットなし)を示す2つのポイントプロットを描画することです。

import seaborn as sns 
import matplotlib.pyplot as plt 
tips = sns.load_dataset("tips") 
#make one plot for the line without points and errorbars 
ax = sns.pointplot(x="day", y="tip", data=tips, markers="", 
        join=True, ci=None, color="k") 
#make one plot for the points without the connecting line 
ax = sns.pointplot(x="day", y="tip", data=tips, 
        palette=sns.color_palette()) 

plt.show() 

enter image description here

欠点がはっきりseabornが完全zorderを無視し、ドットの上に線を描画ということです。

import seaborn as sns 
import matplotlib.pyplot as plt 
tips = sns.load_dataset("tips") 
#make one plot for the line without points and errorbars 
ax = sns.pointplot(x="day", y="tip", data=tips, markers="", 
        join=True, ci=None, color="k") 
#make one plot for the points without the connecting line 
ax = sns.pointplot(x="day", y="tip", data=tips, 
        palette=sns.color_palette()) 

ax.lines[0].set_zorder(2) 
for l in ax.lines[1:]: 
    l.set_zorder(5) 
for c in ax.collections: 
    c.set_zorder(3) 

plt.show() 

enter image description here

:したがって1は、外部から何らかの形で魅力的な結果を持っているZORDERで遊んでする必要があります
関連する問題