Skip to content

patheffects.SimpleLineShadow calling non-existent get_foreground method from GraphicsContextBase #28793

Open
@wsidl

Description

@wsidl

Summary

Source documentation shares that if shadow_color is None, the rho value would be applied to the original color:

https://matplotlib.org/stable/api/patheffects_api.html#matplotlib.patheffects.SimpleLineShadow

Expected Behaviour

Using offset=(0, 0), shadow_color=None, rho=0.6, was looking to explore if a guassian blue would take place to generate a wide, feathered line following the pattern of a gaussian distribution.

Resulting Behaviour

Code fails with:

  File "/project/path/.venv/lib/python3.11/site-packages/matplotlib/patheffects.py", line 336, in draw_path
    r, g, b = (gc0.get_foreground() or (1., 1., 1.))[:3]
               ^^^^^^^^^^^^^^^^^^
AttributeError: 'GraphicsContextBase' object has no attribute 'get_foreground'. Did you mean: 'set_foreground'?

Related line in repo:

r, g, b = (gc0.get_foreground() or (1., 1., 1.))[:3]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions