Plotting y against x is the starting point, and seaborn's two relational functions differ in what they assume about the data. scatterplot assumes every row is its own observation and draws one dot per row. lineplot assumes that x is something that repeats: several rows share the same x (several measurements per day, several runs per setting), so it aggregates: it draws the mean of y at each x, and by default a band around it showing how much the repeats disagree.
The third dial is hue: map a categorical column to colour and the groups separate on the same axes, with a legend that says which colour is which. This question builds a coloured scatter, a mean line, and a mean line with an uncertainty band, and checks each against the numbers it should show.
Implement scatter_by_group(df, x, y, hue, hue_order), mean_line(df, x, y) and line_with_band(df, x, y). The signatures and docstrings are already in the editor.
scatter_by_group(df, x, y, hue, hue_order) draws one scatter point per row of df at (x, y), coloured by the value of the column hue, with the legend entries in hue_order. Returns the Axes.mean_line(df, x, y) draws one line whose points are the mean of y at each distinct x, in ascending x, with no uncertainty band. Returns the Axes.line_with_band(df, x, y) draws the same mean line with a band equal to the mean plus and minus one sample standard deviation (divide by n - 1) of y at each x. Returns the Axes.sns.scatterplot, sns.lineplot). Do not call plt.show().sns.scatterplot(data=df, x=..., y=..., hue=..., hue_order=...) draws one point per row and a legend.
sns.lineplot aggregates repeated x values by default. Its errorbar argument chooses the band: None for no band, "sd" for one standard deviation.
Each call returns the Axes it drew on.
No results yet
Run your code to check it against the examples, or submit to run every test.