Session Ready
Exercise

Plotting your Twitter data

Now that you have the number of tweets that each candidate was mentioned in, you can plot a bar chart of this data and this is what you'll do in this final exercise. You'll use the statistical data visualization library seaborn, which you may not nahve seen before but we'll guide you through. You'll first import seaborn as sns; you'll then construct a barplot of the data using sns.barplot, passing it two arguments: (i) a list of labels and (ii) a list containing the names of the variables you wish to plot (clinton, trump and so on.)

Hopefully, you'll see that Trump was unreasonably represented! In the pre-exercise code, we have run the previous exercise solutions.

Instructions
100 XP
  • Import both matplotlib.pyplot and seaborn, using the aliases plt and sns, respectively.
  • Complete the arguments of sns.barplot: the first argument should be the labels to appear on the x-axis; the second argument should be the list of the names of the variables you wish to plot, as produced in the previous exercise.