Closed orena1 closed 5 years ago
Nope, it's not possible, sorry.
I understand that currently it is not possible? but can't you reopen the ticket and mark is a feature request? Thanks
No, sorry.
@orena1 If you encounter this need again in the future...
from matplotlib import pyplot, transforms
from matplotlib.transforms import Affine2D
from matplotlib.collections import PathCollection
import pandas as pd
import seaborn as sns
def lineplot_plusplus(orientation = "horizontal", **kwargs):
line = sns.lineplot(**kwargs)
r = Affine2D().scale(sx=1, sy=-1).rotate_deg(90)
for x in line.images + line.lines + line.collections:
trans = x.get_transform()
x.set_transform(r+trans)
if isinstance(x, PathCollection):
transoff = x.get_offset_transform()
x._transOffset = r+transoff
old = line.axis()
line.axis(old[2:4] + old[0:2])
xlabel = line.get_xlabel()
line.set_xlabel(line.get_ylabel())
line.set_ylabel(xlabel)
return line
df = pd.DataFrame([[0,1],[0,2],[0,1.5],[1,1],[1,5]], columns=['group','val'])
lineplot_plusplus(x='group',y='val',data=df, orientation = "vertical")
Credit to: https://stackoverflow.com/a/43915452/1825043
Thanks @christian-oreilly !
Adding an optiion to rotate a
seaborn.lineplot
so that the result will be as a function of y and not a function of x.For example, this code:
Create this figure:
But as far as I understand there is no way to rotate the figure in 90° ? so that in the X we will have "val" and in Y we will have "group" and the std will go from left to right and not from bottom to up.
I assume something like
will be great.
See also: https://stackoverflow.com/questions/54445044/how-to-rotate-a-seaborn-lineplot/54448926#54448926 Thanks