If you want to compare two different sets of data, for example 2020 vs 2017, you could put two lines next to each other on your graph.
This involves lots of copy-and-pasting of your code, so can get confusing very fast! Be patient and look at your code carefully to make sure you find the correct parts.
The first step is identifying which bits of your code will need repeating - which parts look at the data and create the graph?
year = "2020.txt" stars = "all" location = "all" data.globeData(year, stars, location) averages = [] for month in data.list: averages.append(sum(month)/len(month)) print(averages) plt.plot(months, averages, color="red")
Your code will look something like the example above.
All of this information is important, so copy all of these lines, and past them underneath - above any other code you have added at the end of your program!
Now you can decide what you want your second line to show, and make a few changes to the second set of code.
averages2.averages to averages2.averages to averages2, and change the colour.This can be very confusing, as all of the code looks very similar. Take it slowly, keep checking for errors, and don't panic - we can help you if you get stuck!
Look at this example, choosing data from 2020 in red and 2017 in blue:
year = "2020.txt" stars = "all" location = "all" data.globeData(year, stars, location) averages = [] for month in data.list: averages.append(sum(month)/len(month)) plt.plot(months, averages, color="red") year = "2017.txt" stars = "all" location = "all" data.globeData(year, stars, location) averages2017 = [] for month in data.list: averages2017.append(sum(month)/len(month)) plt.plot(months, averages2017, color="blue") plt.show()
averages in all three places.plt.show() is right at the very end.