'Not able to change linestyle in Seaborn plot
I have a dataframe modified from iris dataset where there is 1 numeric and 2 categorical columns:
PL Species group
4.400 versicolor A
1.600 setosa B
5.600 virginica A
4.700 versicolor B
6.100 virginica B
I want to plot a seaborn lineplot with lines in black color and with different linestyle for each Species. I tried following codes:
sns.pointplot(data=rnegdf, x='group', y='PL', hue='Species',
color='k', style='Species'); plt.show()
sns.pointplot(data=rnegdf, x='group', y='PL', hue='Species',
color='k', hue_kws=dict(ls=['-','-.','.'])); plt.show()
sns.pointplot(data=rnegdf, x='group', y='PL', hue='Species',
color='k', linestyle='Species'); plt.show()
sns.pointplot(data=rnegdf, x='group', y='PL', hue='Species',
color='k', linestyle='Species', style='Species'); plt.show()
sns.pointplot(data=rnegdf, x='group', y='PL', hue='Species',
color='k', linestyle='Species', style='Species', dashes='Species'); plt.show()
However, they all plot solid lines only:
Why I am not able to change linestyle in this code?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

