Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have an array in python in this format: yearsVsAmounts which returns I am tryi

ID: 3744172 • Letter: I

Question

I have an array in python in this format:

yearsVsAmounts

which returns

I am trying to plot this by importing matlab but it is not successful.

%matplotlib inline
import matplotlib.pyplot as plt
nyears = 10 #how many years are tracked
firstyear = 1880 #first file year
years = range(firstyear,firstyear+nyears-1)
plt.plot( years , Zmtotals[years]);

Im getting either a range error, or if I change some things I get a bunch of errors.

It is just supposed to plot the counts over the time period.

Any idea on how to do this?

Explanation / Answer

import matplotlib.pyplot as plt Zmtotals = {1880: 40, 1881: 35, 1882: 44, 1883: 53, 1884: 51, 1885: 37, 1886: 23, 1887: 27, 1888: 58, 1889: 37} nyears = 10 # how many years are tracked firstyear = 1880 # first file year years = list(range(firstyear, firstyear + nyears - 1)) totals = [Zmtotals[year] for year in years] plt.plot(years, totals) plt.show()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote