Skip to content

fix: label the x axis of the Canny histogram "gradient magnitude", and add xlabel to Histogram.plot - #280

Merged
petercorke merged 1 commit into
mainfrom
fix/canny-histogram-xlabel
Nov 24, 2026
Merged

petercorke merged 1 commit into
mainfrom
fix/canny-histogram-xlabel

Conversation

@petercorke

Copy link
Copy Markdown
Owner

The histogram returned by Image.canny(hist=True) is of gradient magnitude, but its x axis said "pixel value". Histogram.plot now takes an xlabel argument. Its default keeps the old label ("pixel value", or "bin rank" for a sorted histogram), so other histograms are unchanged. CannyHistogram.plot defaults it to "gradient magnitude", for every plot type and style. Any histogram can now be relabelled, for example im.hist().plot(xlabel="grey level").

Tests: the Canny label for each type, a caller's own label, the ax= case, the plain histogram defaults, and the stack and overlay styles. I ran the full suite and mypy, and both are clean.

Not covered here: plot(type="cf") and type="cumulative" fail on a single-plane histogram, which is a separate bug.

AI-assisted: written with Claude Code.

🤖 Generated with Claude Code

…d add xlabel to Histogram.plot

The Canny histogram is of gradient magnitude but its x axis said "pixel value".
Histogram.plot now takes an xlabel argument, whose default is the old label, and
CannyHistogram.plot defaults it to "gradient magnitude".

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 high

Alerts:
⚠ 1 issue (≤ 0 issues of at least minor severity)

Results:
1 new issue

Category Results
ErrorProne 1 high

View in Codacy

🟢 Metrics 12 complexity · 0 duplication

Metric Results
Complexity 12
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@petercorke
petercorke merged commit 95daa06 into main Nov 24, 2026
33 of 34 checks passed
@petercorke
petercorke deleted the fix/canny-histogram-xlabel branch November 24, 2026 07:27
@github-actions github-actions Bot mentioned this pull request Nov 24, 2026
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