GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BUG: Fix text appearing far outside valid axis scale range by scottshambaugh · Pull Request #31061 · matplotlib/matplotlib

Conversation

@scottshambaugh

@scottshambaugh scottshambaugh commented Feb 2, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

PR summary

Closes #31054

Text didn't have a get_tightbbox override yet, so this adds that with some handling for no-show cases. The _in_axes_domain check is not exclusive to text and may be useful elsewhere, so was given to Artist more broadly.

The plot in the original issue renders correctly now, and I can confirm it was broken for me before:

import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 10, 100)
y = np.sin(x) * 10

fig, ax = plt.subplots()
ax.plot(x, y)
ax.set_yscale('log')
ax.text(5, -5, "I am at y = -5", color='red')

plt.savefig("test_gh31054.png", bbox_inches='tight')
test_gh31054

PR checklist

  • "closes #0000" is in the body of the PR description to link the related issue
  • new and changed code is tested
  • [n/a] Plotting related features are demonstrated in an example
  • [n/a] New Features and API Changes are noted with a directive and release note
  • [n/a] Documentation complies with general and docstring guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot added the topic: text label Feb 2, 2026
@scottshambaugh scottshambaugh changed the title BIG: Fix text appearing far outside valid axis scale range BUG: Fix text appearing far outside valid axis scale range Feb 2, 2026
@scottshambaugh
scottshambaugh force-pushed the log_text_negative_coord branch from 0d3ef72 to 7ef9295 Compare February 2, 2026 23:26
@scottshambaugh
Fix text appearing outside axis scale range
4ffb8d3
@scottshambaugh
scottshambaugh force-pushed the log_text_negative_coord branch from 7ef9295 to 4ffb8d3 Compare February 3, 2026 00:13
@scottshambaugh
scottshambaugh marked this pull request as ready for review February 3, 2026 00:26
scottshambaugh
scottshambaugh commented Feb 3, 2026
View reviewed changes
Comment thread lib/matplotlib/text.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

timhoffm
timhoffm reviewed Feb 3, 2026
View reviewed changes
Comment thread lib/matplotlib/artist.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@scottshambaugh
scottshambaugh force-pushed the log_text_negative_coord branch from b558152 to 496411d Compare February 3, 2026 16:44
@scottshambaugh
Rename to _outside_axes_domain
20103e7
@scottshambaugh
scottshambaugh force-pushed the log_text_negative_coord branch from 496411d to 20103e7 Compare February 3, 2026 16:51
@timhoffm timhoffm added the status: waiting for other PR label Feb 8, 2026
@timhoffm

timhoffm commented Feb 8, 2026

Copy link
Copy Markdown
Member

Waiting on #30161. Per #31061 (comment)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@scottshambaugh scottshambaugh removed the status: waiting for other PR label Feb 10, 2026
@scottshambaugh

scottshambaugh commented Feb 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

This one can merge as-is, then the change discussed above that would regenerate baseline images would be in a separate PR that targets #30161.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

timhoffm
timhoffm reviewed Feb 11, 2026
View reviewed changes
Comment thread lib/matplotlib/text.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/matplotlib/artist.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sanrishi sanrishi mentioned this pull request Feb 18, 2026
[ENH]: Give control whether twinx() or twiny() overlays the main axis #31122
Closed
@scottshambaugh @timhoffm
Update lib/matplotlib/text.py
371fcb2
Co-authored-by: Tim Hoffmann <[email protected]>
timhoffm
timhoffm reviewed Feb 25, 2026
View reviewed changes
Comment thread lib/matplotlib/artist.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@scottshambaugh
Move domain check to axes
d1bd978
@github-actions github-actions Bot added the topic: axes label Feb 25, 2026
timhoffm
timhoffm approved these changes Feb 26, 2026
View reviewed changes
QuLogic
QuLogic reviewed Mar 10, 2026
View reviewed changes
Comment thread lib/matplotlib/axes/_base.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@scottshambaugh
Use _axis_map
bb9daee
QuLogic
QuLogic reviewed Mar 10, 2026
View reviewed changes
Comment thread lib/matplotlib/axes/_base.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@QuLogic QuLogic added this to the v3.11.0 milestone Mar 11, 2026
QuLogic
QuLogic approved these changes Mar 11, 2026
View reviewed changes
@QuLogic
QuLogic merged commit 51a1ab6 into matplotlib:main Mar 11, 2026
40 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@scottshambaugh scottshambaugh mentioned this pull request Mar 11, 2026
[MNT]: Scale val_in_range method #31286
Closed
@null-dreams null-dreams mentioned this pull request Mar 14, 2026
[MNT]: Implement Scale.val_in_range and refactor _point_in_data_domain #31306
Merged
3 tasks done
andreas16700 added a commit to andreas16700/matplotlib that referenced this pull request Mar 16, 2026
@andreas16700
Run 51a1ab6: Merge pull request matplotlib#31061 from scottshambaugh/…
dafa843
…log_text_negative_coord
andreas16700 added a commit to andreas16700/matplotlib that referenced this pull request Mar 16, 2026
@andreas16700
Run 51a1ab6: Merge pull request matplotlib#31061 from scottshambaugh/…
4cb0825
…log_text_negative_coord
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@QuLogic QuLogic QuLogic approved these changes
@timhoffm timhoffm timhoffm approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

topic: axes topic: text

Projects

None yet

Milestone

v3.11.0

Development

Successfully merging this pull request may close these issues.

[MNT]: Inconsistency in log-scale handling: bbox_inches='tight' creates massive canvas for negative text coordinates

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@scottshambaugh @timhoffm @QuLogic
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.