import seaborn as sns
sns.set(style="ticks")

dots = sns.load_dataset("dots")

# Define a palette to ensure that colors will be
# shared across the facets
palette = dict(zip(dots.coherence.unique(),
                   sns.color_palette("rocket_r", 6)))

# Set up the FacetGrid with independent x axes
g = sns.FacetGrid(dots, col="align",
                  sharex=False, size=5, aspect=.75)

# Draw the lineplot on each facet
g.map_dataframe(sns.lineplot, "time", "firing_rate",
                hue="coherence", size="choice",
                size_order=["T1", "T2"],
                palette=palette)
g.add_legend()

import seaborn as sns
sns.set(style="ticks")

dots = sns.load_dataset("dots")

# Define a palette to ensure that colors will be
# shared across the facets
palette = dict(zip(dots.coherence.unique(),
                   sns.color_palette("rocket_r", 6)))

# Plot the lines on two facets
sns.relplot(x="time", y="firing_rate",
            hue="coherence", size="choice", col="align",
            size_order=["T1", "T2"], palette=palette,
            height=5, aspect=.75, facet_kws=dict(sharex=False),
            kind="line", legend="full", data=dots)

Update dots lineplot example to use relplot
Update dots lineplot example to use relplot

  import seaborn as sns
  sns.set(style="ticks")
  
  dots = sns.load_dataset("dots")
  
  # Define a palette to ensure that colors will be
  # shared across the facets
  palette = dict(zip(dots.coherence.unique(),
                     sns.color_palette("rocket_r", 6)))
  
- # Set up the FacetGrid with independent x axes
- g = sns.FacetGrid(dots, col="align",
-                   sharex=False, size=5, aspect=.75)
+ # Plot the lines on two facets
+ sns.relplot(x="time", y="firing_rate",
+             hue="coherence", size="choice", col="align",
+             size_order=["T1", "T2"], palette=palette,
+             height=5, aspect=.75, facet_kws=dict(sharex=False),
+             kind="line", legend="full", data=dots)
  
- # Draw the lineplot on each facet
- g.map_dataframe(sns.lineplot, "time", "firing_rate",
-                 hue="coherence", size="choice",
-                 size_order=["T1", "T2"],
-                 palette=palette)
- g.add_legend()
- 
Update dots lineplot example to use relplot
## Code Before:
import seaborn as sns
sns.set(style="ticks")

dots = sns.load_dataset("dots")

# Define a palette to ensure that colors will be
# shared across the facets
palette = dict(zip(dots.coherence.unique(),
                   sns.color_palette("rocket_r", 6)))

# Set up the FacetGrid with independent x axes
g = sns.FacetGrid(dots, col="align",
                  sharex=False, size=5, aspect=.75)

# Draw the lineplot on each facet
g.map_dataframe(sns.lineplot, "time", "firing_rate",
                hue="coherence", size="choice",
                size_order=["T1", "T2"],
                palette=palette)
g.add_legend()

## Instruction:
Update dots lineplot example to use relplot
## Code After:
import seaborn as sns
sns.set(style="ticks")

dots = sns.load_dataset("dots")

# Define a palette to ensure that colors will be
# shared across the facets
palette = dict(zip(dots.coherence.unique(),
                   sns.color_palette("rocket_r", 6)))

# Plot the lines on two facets
sns.relplot(x="time", y="firing_rate",
            hue="coherence", size="choice", col="align",
            size_order=["T1", "T2"], palette=palette,
            height=5, aspect=.75, facet_kws=dict(sharex=False),
            kind="line", legend="full", data=dots)
