Skip to content

[Bug]: path_effects on text gives an error in matplotlib 3.11 #31927

@jacopok

Description

@jacopok

Bug summary

Trying to use path_effects on some text gives an error in matplotlib 3.11, while it ran properly in 3.10.

Code for reproduction

import matplotlib.pyplot as plt
from matplotlib import patheffects

white_stroke = [patheffects.withStroke(linewidth=4, foreground="w")]

text = plt.text(0.5, 0.5, 'Hello')
text.set_path_effects(white_stroke)

plt.show()

Actual outcome

  File "/home/jacopo/thesis/.venv/lib/python3.11/site-packages/matplotlib/backend_bases.py", line 509, in draw_tex
    self._draw_text_as_path(gc, x, y, s, prop, angle, ismath="TeX")
TypeError: RendererBase._draw_text_as_path() missing 1 required positional argument: 'mtext'

Expected outcome

A figure should be rendered saying "Hello" in the center.

Additional information

No response

Operating system

No response

Matplotlib Version

3.11

Matplotlib Backend

No response

Python version

3.11

Jupyter version

No response

Installation

uv

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions