Repository navigation
Document showing a test's own plot with add_image - #54
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 newFigureinstead of withpyplot, 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 theprairielearn/grader-python-pytest:latestimage, using this branch's source.🤖 Generated with Claude Code