Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
anijjar wants to merge6 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromanijjar:bug/28793
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionlib/matplotlib/patheffects.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -325,7 +325,7 @@
gc0.copy_properties(gc)

if self._shadow_color is None:
r, g, b = (gc0.get_foreground() or (1., 1., 1.))[:3]
r, g, b = (gc0.get_rgb() or (1., 1., 1.))[:3]

Check warning on line 328 in lib/matplotlib/patheffects.py

View check run for this annotation

Codecov/ codecov/patch

lib/matplotlib/patheffects.py#L328

Added line #L328 was not covered by tests
# Scale the colors by a factor to improve the shadow effect.
shadow_rgbFace = (r * self._rho, g * self._rho, b * self._rho)
else:
Expand Down
22 changes: 20 additions & 2 deletionslib/matplotlib/tests/test_patheffects.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
import platform

import numpy as np

from matplotlib.testing.decorators import image_comparison
from matplotlib.testing.decorators import image_comparison, check_figures_equal
import matplotlib.pyplot as plt
import matplotlib.patheffects as path_effects
from matplotlib.path import Path
Expand DownExpand Up@@ -214,3 +213,22 @@ def close_group(self, s):

assert renderer.open_group('s') == "open_group overridden"
assert renderer.close_group('s') == "close_group overridden"


@check_figures_equal()
def test_simpleLineShadow_plot(fig_test, fig_ref):
# Create the plots
ax_ref = fig_ref.add_subplot()
ax_test = fig_test.add_subplot()

# Generate Gaussian distribution data
x = np.linspace(-5, 5, 500)
y = np.exp(-x**2)

# Plot the Gaussian line with the SimpleLineShadow path effect
line, = ax_test.plot(x, y, linewidth=5)
line.set_path_effects([path_effects.SimpleLineShadow(
offset=(0, 0), shadow_color='blue', rho=0.5)])

# Plot the Gaussian line simply
ax_ref.plot(x, y, linewidth=5, color='blue', alpha=0.3)
Loading

[8]ページ先頭

©2009-2025 Movatter.jp