Guided Project: Investigating Fandango Movie Ratings 538 style

import matplotlib.pyplot as plt
from numpy import arange
%matplotlib inline
plt.style.use(‘fivethirtyeight’)

fandango_2015['Fandango_Stars'].plot.kde(label = '2015', legend = True, figsize = (8,5.5))
fandango_2016['fandango'].plot.kde(label = '2016', legend = True)

plt.title("Comparing distribution shapes for Fandango's ratings\n(2015 vs 2016)",
          y = 1.07) # the `y` parameter pads the title upward
plt.xlabel('Stars')
#The tick labels of the x-axis are: [0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0]
plt.xlim(0,5) # because ratings start at 0 and end at 5
plt.xticks(arange(0,5.1,.5))


#fte_graph.tick_params(axis = 'both', which = 'major', labelsize = 18)

plt.show()

These are a few next steps to consider:

  • Customize your graphs more by reproducing almost completely the FiveThirtyEight style. You can take a look at this tutorial if you want to do that.

I am trying to implement the 538 style from this article , but it is not obvious where to edit the existing graph’s code in order to change the tick param since there are two plots in one graph…please advise?
https://app.dataquest.io/m/288/guided-project%3A-investigating-fandango-movie-ratings/8/next-steps

I am trying to work out how to edit this code and where to insert the 538 code
I cannot do as below

#


f.tick_params(axis = 'both', which = 'major', labelsize = 18)

because there are two plots
\   f= fandango_2015['Fandango_Stars'].plot.kde(label = '2015', legend = True, figsize = (8,5.5))
   g= fandango_2016['fandango'].plot.kde(label = '2016', legend = True)

I also cannot get it working when I try to add title and subtitle

import matplotlib.pyplot as plt
from numpy import arange
%matplotlib inline
plt.style.use('fivethirtyeight')

f=fandango_2015['Fandango_Stars'].plot.kde(label = '2015', legend = True, figsize = (8,5.5))
g=fandango_2016['fandango'].plot.kde(label = '2016', legend = True)

plt.title("Comparing distribution shapes for Fandango's ratings\n(2015 vs 2016)",
          y = 1.07) # the `y` parameter pads the title upward
plt.xlabel('Stars')
#The tick labels of the x-axis are: [0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0]
plt.xlim(0,5) # because ratings start at 0 and end at 5
plt.xticks(arange(0,5.1,.5))

# Adding a title and a subtitle
f.text(x = 1966.65, y = 62.7, s = "The gender gap is transitory - even for extreme cases",
               fontsize = 26, weight = 'bold', alpha = .75)
g.text(x = 1966.65, y = 57,
               s = 'Percentage of Bachelors conferred to women from 1970 to 2011 in the US for\nextreme cases where the percentage was less than 20% in 1970',
              fontsize = 19, alpha = .85)

plt.show()