Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I had a difficult time to clear my graph because I feel like it was not right to do as the instruction said (like the

image text in transcribed

I had a difficult time to clear my graph because I feel like it was not right to do as the instruction said (like the 5-step or 10-step increments)

here is my coding and the graph:

import matplotlib.pyplot as plt NOLA_FILE = "nola_weather_feb.csv" years = [] high_temperature = [] low_temperature = [] with open(NOLA_FILE, "r") as file: for line in file: year, max_temp, min_temp, mean, humidity = line.strip().split(",") years.append(year) high_temperature.append(max_temp) low_temperature.append(min_temp) highest_temperature_year = years[high_temperature.index(max(high_temperature))] highest_temperature = max(high_temperature) plt.scatter(years, high_temperature, color = "red", label = "High Temperature") plt.scatter(years, low_temperature, color = "blue", label = "Low Temperature") plt.scatter(highest_temperature_year, highest_temperature, color = "orange", marker = "X", s=200) plt.title("Temperature of Mardi Gras in New Orleans (1922-2022)") plt.xlabel("Year") plt.ylabel("Temperature in Fahrenheit") plt.legend() pos = [i for i in range(0, len(years), 5)] years_range = range(1922, 2023, 5) plt.xticks(pos, years_range, rotation = 45) plt.show()

image text in transcribed

Filename:nola_v1.py Also submit: A screenshot (or download) of your plot Input files: Download nola weather feb.csv and save it in the same directory as your nola_v1.py file Mardi Gras is coming up! It's one of Laney's favorite holidays, but before she plans a trip back to New Orleans to celebrate it, she wants to check on the weather patterns. Is it usually too hot, too cold, or fine? Let's find out! The input data file contains the high, low, and mean temps (and humidity) on Mardi Gras Tuesday going back to 1922 . For this problem, create a plot showing three things: - All the high temps with year as the x-value and its temp as the y-value - All the low temps, on the same scatterplot but a different color than the highs - The year and temp when the high temp was the highest (in our solution, we plotted all the highs and lows first, then plotted this one data point in a bigger, brighter X so it stands out) For full credit, your program must: - Create three lists: years, high temps, and low temps (all ints) - Find the year and temp when the high temp was highest - Create a plot as described above that includes a legend, title, labels, etc. as usual - Put your own xticks on your plot that are readable and clear. This might be a little tricky! Try something like this: - Create a list of positions in 5-step or 10-step increments, so it would look like pos =[0,5, 10,15,] - Create a list of every 5th or every 10th year from the file, so it would look like years = [1922,1927,1932,. After creating your plot, call plt.xticks(pos, years) 0 If it still looks too crowded, try a rotation, like plt.xticks(pos, years, rotation = 45) Consider using what you know about range and list comprehension to make this all work! Temperature of Mardi Gras in New Orleans (1922-2022)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

More Books

Students also viewed these Databases questions

Question

Question Can a self-employed person adopt a profit sharing plan?

Answered: 1 week ago