Search code examples
pythonseaborn

Rotating seaborn lineplot


I would like to rotate seaborn.lineplot, so height would be on the y axis and weighted PAVD would be on x.

sns.lineplot(data = df, y = "weightedPAVD", x = "# height", ci = 10, color = "darkgreen")
plt.show()

enter image description here

However, if I change x and y, the figure is messed up.

sns.lineplot(data = df, x = "weightedPAVD", y = "# height", ci = 10, color = "darkgreen")
plt.show()

enter image description here

How to fix this?


Solution

  • With seaborn v0.12+, add orient="y" to sort/aggregate/connect over the y variable instead of the x variable.