This notebook is an exercise in the Data Visualization course. You can reference the tutorial at this link.
In this exercise, you'll explore different chart styles, to see which color combinations and fonts you like best!
Run the next cell to import and configure the Python libraries that you need to complete the exercise.
import pandas as pd
pd.plotting.register_matplotlib_converters()
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
print("Setup Complete")
Setup Complete
The questions below will give you feedback on your work. Run the following cell to set up our feedback system.
# Set up code checking
import os
if not os.path.exists("../input/spotify.csv"):
os.symlink("../input/data-for-datavis/spotify.csv", "../input/spotify.csv")
from learntools.core import binder
binder.bind(globals())
from learntools.data_viz_to_coder.ex6 import *
print("Setup Complete")
Setup Complete
You'll work with a chart from the previous tutorial. Run the next cell to load the data.
# Path of the file to read
spotify_filepath = "../input/spotify.csv"
# Read the file into a variable spotify_data
spotify_data = pd.read_csv(spotify_filepath, index_col="Date", parse_dates=True)
Run the command below to try out the "dark"
theme.
# Change the style of the figure
# darkgrid whitegrid dark white ticks
sns.set_style("dark")
# Line chart
plt.figure(figsize=(12,6))
sns.lineplot(data=spotify_data)
# Mark the exercise complete after the code cell is run
step_1.check()
Correct:
Now, try out different themes by amending the first line of code and running the code cell again. Remember the list of available themes:
"darkgrid"
"whitegrid"
"dark"
"white"
"ticks"
This notebook is your playground -- feel free to experiment as little or as much you wish here! The exercise is marked as complete after you run every code cell in the notebook at least once.
Learn about how to select and visualize your own datasets in the next tutorial!
Have questions or comments? Visit the Learn Discussion forum to chat with other Learners.