Plotting grades against assignment number
<p>I want to do a plot in Python3 that will show me the assignments on the x-axis and the grades on the y-axis. The x-axis must show all assignments from 1 to M, and the y-axis must show all grades 3 to 12. </p>

<p>Input is a matrix of grades for M assignments: e.g. for 6 Assignments I have the following input: </p>

<pre><code>array([[10, -3, 10, ..., 7, 0, 12],
   [12, 12, 12, ..., 10, 0, 12],
   [7, 7, 10, ..., 10, 0, 10],
   [7, 4, 7, ..., 7, 0, 12],
   [-3, 4, 7, ..., 4, 4, 12],
   [7, 4, 4, ..., 4, 0, 12]], dtype=object)
</code></pre>

<ul>
<li>First row - assignment 1 grades</li>
<li>Second row - assignment 2 grades</li>
<li>etc.</li>
</ul>

<p>The plot must also contain:</p>

<ol>
<li>Each of the given grades marked by a dot. I need to add a small random
number (between -0.1 and 0.1) to the x- and y-coordinates of each dot, to
be able tell apart the different dots which otherwise would be on top of each
other when more than one student has received the same grade in the same
assignment.</li>
<li>The average grade of each of the assignments plotted as a line.</li>
</ol>

<p>I have started by trying with a for loop to plot each assignment, but it does not seem to work - therefore I am stuck at the moment. </p>

<pre><code>import matplotlib.pyplot as plt
yaxis = np.arange(-3, 13)    
for i in range(len(assignments)-1):
    plt.plot(assignments[i, :], yaxis, label = "Assignemnt [i]")

plt.title("Grades per assignment")
plt.xlabel("Assignments")
plt.ylabel("Grades")
plt.show()  
</code></pre>