pog87/PtitPrince

offset for boxplot

bpinsard opened this issue · 2 comments

I want to plot from 2 dataframes, one is my dataset and the other one is a normative larger dataset to which I compare. Combining the two datasets would be difficult.
If I call Rainplot twice, I can use offset and move args to shift the second dataset to the right, though the boxplot do not follow (see image below).
image

box_positions cannot be used to move the boxplot, as it is already passed by seaborn to matplotlib.
Is there a simple workaround?
Thanks!

I managed to shift the boxplot with that hacked function, which will likely only work for a single distribution.
takes the axis and the shift in x and y.

def shift_rc_boxplot(ax, x, y):
    for bp_part in ax.lines[:6] + ax.patches[:1]:
        bp_part.set_transform(matplotlib.transforms.Affine2D().translate(x,y) + ax.transData)
pog87 commented

I don't have any idea on what could cause this. Could you provide a minimal working example?