1
sns.pointplot()
でパレットを使用すると、join=True
を設定しても線が表示されないか、任意の線種を選択してもパレットの色があります。それはそうなのでしょうか?または、ポイントを接続するために設定できる他のパラメータはありますか?ラインは1色にすることができます。パレットが設定されているときに点線が表示されない
sns.pointplot()
でパレットを使用すると、join=True
を設定しても線が表示されないか、任意の線種を選択してもパレットの色があります。それはそうなのでしょうか?または、ポイントを接続するために設定できる他のパラメータはありますか?ラインは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()
欠点がはっきり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()
:したがって1は、外部から何らかの形で魅力的な結果を持っているZORDERで遊んでする必要があります