From the supplied repeated df visits, show replicate B over day as a line with markers and no aggregation.
The editable setup on the right creates df. Run executes the setup and your work from top to bottom.
Your requirements
- This report follows one replicate, not a mean across replicates.
- Chart: title "Daily site visits · paired observations"; x "day"; y "visits".
Your inputs
| day | visits | replicate |
|---|---|---|
| 1 | 12 | A |
| 1 | 14 | B |
| 2 | 16 | A |
| 2 | 18 | B |
| 3 | 14 | A |
| 3 | 16 | B |
| 4 | 20 | A |
| 4 | 22 | B |
Remember the idea
When several rows share an x value, a line can summarize them or follow one repeated measurement series.
A small example
At day 1, replicates A=4 and B=8 have mean 6. Selecting replicate A instead plots its observed value 4.
| Code or choice | Meaning |
|---|---|
estimator="mean" | One average y at each x. |
errorbar="sd" | Show spread around that average using one standard deviation. |
estimator=None | Do not aggregate repeated x values; filter to one replicate to follow its trajectory. |
Hint
Choose the observations first, then map the requested measurements to the chart.
Reveal solution
One way to do it. Keep any supplied setup in the editor and use this in the Your work section.
import matplotlib.pyplot as plt
import seaborn as sns
fig, ax = plt.subplots(figsize=(6, 4))
selected = df[df["replicate"] == "B"]
sns.lineplot(data=selected, x="day", y="visits", estimator=None, marker="o", ax=ax)
ax.set(title="Daily site visits · paired observations", xlabel="day", ylabel="visits")
fig.tight_layout()
plt.show()