''' plot_bones.py DS2000 Spring 2022 Plotting the bones days per week ''' import matplotlib.pyplot as plt MSIZE = 12 def main(): # Step one: gather the month from the user # and read from the file month = input("Enter the month.\n") filename = month + "_bones.txt" print("Your file:", filename) with open(filename, "r") as bones: # read first week in from file and plot week = bones.readline().strip() days = int(bones.readline()) x_pos = 1 plt.plot(x_pos, days, 'o', color = 'deepskyblue', markersize = MSIZE, label = week) # read second week in from file and plot week = bones.readline().strip() days = int(bones.readline()) # x_pos += 1 EXACTLY THE SAME AS x_pos = x_pos + 1 x_pos += 1 plt.plot(x_pos, days, 'o', color = 'orange', markersize = MSIZE, label = week) # read third week in from file and plot week = bones.readline().strip() days = int(bones.readline()) x_pos += 1 plt.plot(x_pos, days, 's', color = 'firebrick', markersize = MSIZE, label = week) # read fourth week in from file and plot week = bones.readline().strip() days = int(bones.readline()) x_pos += 1 plt.plot(x_pos, days, 's', color = 'hotpink', markersize = MSIZE, label = week) # Label the axes plt.xlabel("Weeks") plt.ylabel("Bones Days") # Give the graph a title plt.title("Bones Days per week in November") # Change the range of the y axis plt.ylim(0, 7) # Make a legend show up plt.legend() # Fix the numbers on the x axis plt.xticks([1, 2, 3, 4]) main()