Exercise: Bubble Chart and Hex Bin Chart
Use the concepts you’ve learned so far to solve this exercise.
We'll cover the following...
Consider the following dataset describing the average download/upload speed in European countries from 2019 to 2022:
Press + to interact
import pandas as pddf = pd.read_csv('data/average_internet_speed.csv',parse_dates=['quarter'])print(df)
In the following terminal, represent the data through a bubble chart:
Press + to interact
import pandas as pdimport altair as altimport osdf = pd.read_csv('data/average_internet_speed.csv',parse_dates=['quarter'])# build the chart# use mark_point() to draw the points# encode the average upload and download speeds in the x and y channels# encode the country using the color channel.# highlight the color of a single country (e.g. IT), using alt.condition()# chart = alt.Chart()df# uncomment the following lines to show the chart#chart.save('chart.html')#os.system('cat chart.html')
Then, represent the dataset through a hex bin chart in the ...