## Question Authors' Forum

### Ideas for assessing Matplotlib via standard Moodle quiz question types

by Richard Lissaman -
Number of replies: 2

Hi, I'm new to this forum. My name is Richard Lissaman, I'm teaching a Python module for 1st year maths students at the University of Warwick in the UK. I'm a real beginner with CodeRunner (as of about 6 weeks ago) but am enjoying it very much and the students are having fun with CodeRunner questions.

I really need to be able to assess students' use of Matplotlib via Moodle quizzes. I see there are things about this in these forums but I don't feel confident enough to try anything too advanced with CodeRunner just yet.

Does anyone have experience of ways to assess students' use of Matplotlib via standard Moodle quiz question types? I realise that this is never going to be that great but wondered if anyone has any pointers on this.

Many thanks, Richard

### Re: Ideas for assessing Matplotlib via standard Moodle quiz question types

by Richard Lobb -
We assess matplotlib questions in two of our courses, but we have a very complex question type that is almost certainly too daunting for a relative newcomer (though you're welcome to try your luck with it if you're feeling brave).

Our question type displays in the results table the plots the students draw side-by-side with our expected plots. But the displayed images are just for show - the actual grading is done by comparing a textual description of selected properties of the displayed image with the expected description.

The question contains as one of its support files a module __plottools.py (attached) that defines a function print_plot_info() to output selected properties of the most-recently drawn graph. We insert a call to this function after each test (using the Extra field in the author form). The simplest calls are just

print_plot_info('lines')
or
print_plot_info('bars')

thought there are lots of other parameters. The function generates output such as (for a bar chart):

Plot title: 'Temperatures during the week'
X-axis label: 'Day of week'
Y-axis label: 'Temperature'
(x, y) grid lines enabled: (False, False)
X-axis ticks at  0, 1, 2, 3, 4
X-axis tick labels:
Monday, Tuesday, Wednesday, Thursday, Friday

Bars:
Bar0: x = 0, height = 15.0
Bar1: x = 1, height = 18.0
Bar2: x = 2, height = 19.0
Bar3: x = 3, height = 21.0
Bar4: x = 4, height = 16.0
However, even this function is probably a bit daunting, and it needs scipy installed on the Jobe server (as well as numpy and matplotlib, of course) in order to interpolate y values at selected x values when displaying line plots. But perhaps it gives you some ideas to work with?