Chocolate Project - Beautiful Soup Scraping PLEASE HELP

Hello everyone! I have been doing this Chocolate Project for pretty much time and can’t find out why it shows a graph that surely is not correct. Could you please help me find the error in my code?

image
so this is how my wrong graph looks like, what is incorrect.

import codecademylib3_seaborn

from bs4 import BeautifulSoup

import requests

import pandas as pd

import matplotlib.pyplot as plt

import numpy as np

webpage = requests.get('https://content.codecademy.com/courses/beautifulsoup/cacao/index.html')

soup = BeautifulSoup(webpage.content, "html.parser")

rating_tags = soup.find_all(attrs={"class":"Rating"})

ratings = []

for td in rating_tags[1:]:

  ratings.append(float(td.get_text()))

plt.hist(ratings)

plt.show()

names = []

name_tags = soup.find_all(attrs={"class":"Company"})

for td in name_tags[1:]:

  names.append(td.get_text())

d = {"Company":names, "Ratings":ratings}

data_frame = pd.DataFrame.from_dict(d)

grouped_ratings = data_frame.groupby("Company").Ratings.mean()

ten_best = grouped_ratings.nlargest(10)

cocoa_percent = []

cocoa_tags = soup.find_all(attrs={"class":"CocoaPercent"})

for td in cocoa_tags[1:]:

  cocoa_percent.append(float(td.get_text().strip('%')))

data_frame["CocoaPercentage"] = cocoa_percent

plt.scatter(data_frame.CocoaPercentage, data_frame.Ratings)

plt.show()

z = np.polyfit(data_frame.CocoaPercentage, data_frame.Ratings, 1)

line_function = np.poly1d(z)

plt.plot(data_frame.CocoaPercentage, line_function(data_frame.CocoaPercentage), "r--")

plt.show()

Looks like more than one plot on the same axis, try creating a new figure or something similar before adding your second plot.