Skip to content

[Bug]: Backgroundcolor of text is set in a too wide range #29874

@siegbert7

Description

@siegbert7

Bug summary

Backgroundcolor of text is set in a too wide range when setting it for the first time.
Problem: Border of first color remains when backgroundcolor is set again.

Image

Code for reproduction

''' Backgroundcolor of text is set in a too wide range when setting it for the first time.
    Problem: Border of first color remains when backgroundcolor is set again.'''

# windows 11
# Python version 3.13.2
# Matplotlib version 3.10.1

import matplotlib.pyplot as plt

fig, ax = plt.subplots(1, 1)
fig.set_dpi(100)

txt   = ax.text(0.1, 0.8, 'There should not be a red border around this text !')

##txt.set(backgroundcolor='none')     # Uncomment this line as workaround to avoid red border
txt.set(backgroundcolor='red')        # Set backgroundcolor for the first time
txt.set(backgroundcolor='none')       # Cannot reset backgroundcolor of text completely, red border remains

plt.show()

Actual outcome

Text with red border, see picture above.

Expected outcome

Text without red border.

Additional information

There is a workaround for the first, but not a fix, see Python program above.

Operating system

Windows

Matplotlib Version

3.10.1

Matplotlib Backend

tkagg

Python version

3.13.2

Jupyter version

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy