I have following code:
g = sns.FacetGrid(correct_data, hue="congruency", col="PP", row="cue", height=4, ylim=(.4, .9))
g.map(sns.pointplot, "pattern", "RT")
This allows me to create a line plot per participant (PP) and cue (cue) showing separate lines for each level of congruency. Each line shows the relationship between pattern (X-axis) and reaction time (RT on the Y-axis). I would like the reverse the order of the categorical values on the X-axis, how can I do this? The "pattern"-variable has two levels, but I like to reverse the default order in which it is displayed.
Thank you.
You can pass the order=
parameter (as well as hue_order=
) to sns.pointplot()
inside the call to g.map()
to choose the order of the categorical variable
att = sns.load_dataset("attention")
g = sns.FacetGrid(att, col="subject", col_wrap=5, height=1.5)
g = g.map(sns.pointplot, "solutions", "score", order=[3,1,2])