Skip to content

Document showing a test's own plot with add_image - #54

Merged
eliotwrobson merged 1 commit into
mainfrom
docs-instructor-plots
Nov 18, 2026
Merged

eliotwrobson merged 1 commit into
mainfrom
docs-instructor-plots

Conversation

@eliotwrobson

Copy link
Copy Markdown
Collaborator

Description

The quick start's "Showing Plots to Students" section only covered showing the student's plot. This adds a note and an example showing that a test can draw its own plot, such as the expected plot or a plot of values that student code returned, and show it with feedback.add_image. The note says to draw on a new Figure instead of with pyplot, so one test's plot doesn't end up in another test's figure. It also says that PNG bytes work for images made some other way.

This covers the remaining part of PrairieLearn/PrairieLearn#10941 for this grader. The rest of that issue, the 1 MB size limit and how plot grading works, is already documented here.

Testing

The example's plotting code renders a 27 KB PNG through add_image's PNG path in the prairielearn/grader-python-pytest:latest image, using this branch's source.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eliotwrobson
eliotwrobson marked this pull request as ready for review November 18, 2026 21:08
@eliotwrobson
eliotwrobson merged commit f9611ff into main Nov 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant