Skip to content

Commit 1368daf

Browse files
committed
fixing linewidth antialiased
1 parent 7b15c06 commit 1368daf

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

pygame_matplotlib/backend_pygame.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,12 @@ def draw_path(self, gc, path, transform, rgbFace=None):
181181
if not isinstance(transform, IdentityTransform):
182182
transform += transfrom_to_pygame_axis
183183

184-
draw_func = ( # Select whether antialiased will be used in pygame
185-
pygame.draw.aaline if gc.get_antialiased() else pygame.draw.line
184+
draw_func = (
185+
# Select whether antialiased will be used in pygame
186+
# Antialiased cannot hanlde linewidth > 1
187+
pygame.draw.aaline
188+
if gc.get_antialiased() and linewidth <= 1
189+
else pygame.draw.line
186190
)
187191

188192
previous_point = (0, 0)

test_show.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
print(type(fig))
1919

2020
axes[0, 0].plot([1,2], [1,2], color='green', label='test')
21-
axes[0, 0].plot([1,2], [1,1], color='orange', label='test other')
21+
axes[0, 0].plot([1,2], [1,1], color='orange', lw=5, label='test other larger')
2222
# axes[0, 0].legend()
2323
axes[0, 1].text(0.5, 0.5, '2', size=50)
2424
axes[1, 0].set_xlabel('swag')

0 commit comments

Comments
 (0)