Python help - matplotlib - creating graphs for lists of different sizes?

I have a list, moose, which is the moose population over a number of years. I also have another list, PredRate, that is the predation rate of those moose over the same years. The issue is that the PredRate data is not available for all the years.

I'm trying to graph moose over PredRate, to demonstrate a negative relationship. Here's what I have:

import csv

import matplotlib.pyplot as plt

import numpy as np

import scipy.optimize as op

import matplotlib.animation as animation

#titling things

dates = []

moose = []

wolves = []

KillRate = []

PredRate = []

i = 0

filename = "IsleRoyale.csv"

#initializing columns and rows

fields = []

rows = []

with open(filename, 'r') as csvfile:

# creating a csv reader object

csvreader = csv.reader(csvfile, delimiter = ',')

# extracting each data row one by one

for row in csvreader:

try:

dates.append(int(row[0]))

moose.append(float(row[1]))

wolves.append(float(row[2]))

KillRate.append(float(row[3]))

PredRate.append(float(row[4]))

except:

fields.append(row[0])

fields.append(row[1])

fields.append(row[2])

fields.append(row[3])

fields.append(row[3])

plt.plot(PredRate, moose)

plt.show()

plt.close()

But I'm getting a **kwargs error

Any help would be appreciated!

There are no answers yet.
Be the first to answer this question.