Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
3-variable Lineplot | More and More Plots
First Dive into seaborn Visualization
course content

Contenido del Curso

First Dive into seaborn Visualization

First Dive into seaborn Visualization

1. Nice to Meet you, seaborn!
2. More and More Plots
3. Plot Customization

book3-variable Lineplot

With the help of the seaborn, we can view the dynamics of the population, for example, relative to each season during 10 years by adding the third variable to our lineplot.

To initialize a lineplot based on the pandas DataFrame, you need to input at least 4 parameters: x, y (columns-markers for the plot), hue (the third variable), and data (the DataFrame containing the data).

Look at the code below!

12345678910111213
# Importing libraries needed import seaborn as sns import matplotlib.pyplot as plt import pandas as pd # Reading the file df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/c5b4ea8f-8a30-439f-9625-ddf2effbd9ac/example5.csv') # Creating the 3-variable lineplot sns.lineplot(x = 'x', y = 'y', hue = 'gender', data=df) # Showing the plot plt.show()
copy

Tarea

  1. Import the seaborn with sns alias.
  2. Import the matplotlib.pyplot with plt alias.
  3. Import the pandas withpd alias.
  4. Read the file using df variable.
  5. Create a 3-variable lineplot using 'year' column for the x-value and 'population' column for the y-value and 'season' for the hue-value.
  6. Show the plot.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 6
toggle bottom row

book3-variable Lineplot

With the help of the seaborn, we can view the dynamics of the population, for example, relative to each season during 10 years by adding the third variable to our lineplot.

To initialize a lineplot based on the pandas DataFrame, you need to input at least 4 parameters: x, y (columns-markers for the plot), hue (the third variable), and data (the DataFrame containing the data).

Look at the code below!

12345678910111213
# Importing libraries needed import seaborn as sns import matplotlib.pyplot as plt import pandas as pd # Reading the file df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/c5b4ea8f-8a30-439f-9625-ddf2effbd9ac/example5.csv') # Creating the 3-variable lineplot sns.lineplot(x = 'x', y = 'y', hue = 'gender', data=df) # Showing the plot plt.show()
copy

Tarea

  1. Import the seaborn with sns alias.
  2. Import the matplotlib.pyplot with plt alias.
  3. Import the pandas withpd alias.
  4. Read the file using df variable.
  5. Create a 3-variable lineplot using 'year' column for the x-value and 'population' column for the y-value and 'season' for the hue-value.
  6. Show the plot.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 6
toggle bottom row

book3-variable Lineplot

With the help of the seaborn, we can view the dynamics of the population, for example, relative to each season during 10 years by adding the third variable to our lineplot.

To initialize a lineplot based on the pandas DataFrame, you need to input at least 4 parameters: x, y (columns-markers for the plot), hue (the third variable), and data (the DataFrame containing the data).

Look at the code below!

12345678910111213
# Importing libraries needed import seaborn as sns import matplotlib.pyplot as plt import pandas as pd # Reading the file df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/c5b4ea8f-8a30-439f-9625-ddf2effbd9ac/example5.csv') # Creating the 3-variable lineplot sns.lineplot(x = 'x', y = 'y', hue = 'gender', data=df) # Showing the plot plt.show()
copy

Tarea

  1. Import the seaborn with sns alias.
  2. Import the matplotlib.pyplot with plt alias.
  3. Import the pandas withpd alias.
  4. Read the file using df variable.
  5. Create a 3-variable lineplot using 'year' column for the x-value and 'population' column for the y-value and 'season' for the hue-value.
  6. Show the plot.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

With the help of the seaborn, we can view the dynamics of the population, for example, relative to each season during 10 years by adding the third variable to our lineplot.

To initialize a lineplot based on the pandas DataFrame, you need to input at least 4 parameters: x, y (columns-markers for the plot), hue (the third variable), and data (the DataFrame containing the data).

Look at the code below!

12345678910111213
# Importing libraries needed import seaborn as sns import matplotlib.pyplot as plt import pandas as pd # Reading the file df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/c5b4ea8f-8a30-439f-9625-ddf2effbd9ac/example5.csv') # Creating the 3-variable lineplot sns.lineplot(x = 'x', y = 'y', hue = 'gender', data=df) # Showing the plot plt.show()
copy

Tarea

  1. Import the seaborn with sns alias.
  2. Import the matplotlib.pyplot with plt alias.
  3. Import the pandas withpd alias.
  4. Read the file using df variable.
  5. Create a 3-variable lineplot using 'year' column for the x-value and 'population' column for the y-value and 'season' for the hue-value.
  6. Show the plot.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 2. Capítulo 6
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
some-alt