Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

'annotate' ignores path_effects argument. #2032

Merged
merged 1 commit into from

3 participants

@leejjoon
Owner

With current master, annotate ignores path_effects argument.

import matplotlib.pyplot as plt
from matplotlib.patheffects import withStroke
myeffect = withStroke(foreground="y", linewidth=3)
kwargs = dict(path_effects=[myeffect])

plt.annotate("test", (0.5, 0.5), path_effects=[myeffect])

text is drawn, but without path_effects.

@leejjoon leejjoon referenced this pull request from a commit in mdboom/matplotlib
@mdboom mdboom Add xkcd() function to set up a number of parameters to create plots …
…that look like xkcd. Add an example, and a what's new. Expose path effects as an rcParam so that they can be set globally.
c288df2
@mdboom mdboom Handle setting path_effects in the constructor using the setp infrast…
…ructure, so it doesn't have to be duplicated in each subclass. Modify a test to make sure this continues to work.
0266d90
@mdboom
Owner

Indeed, I had intended for everything to be handled in the base class, so therefore the path_effects kwarg should be removed and it should be handled by the calling setp instead. I've attached a fix, and modified a test so we test setting a path_effect directly in the constructor.

@pelson pelson merged commit cadcefc into from
@mdboom mdboom deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 21, 2013
  1. @mdboom

    Handle setting path_effects in the constructor using the setp infrast…

    mdboom authored
    …ructure, so it doesn't have to be duplicated in each subclass. Modify a test to make sure this continues to work.
This page is out of date. Refresh to see the latest.
View
4 examples/pylab_examples/patheffect_demo.py
@@ -9,9 +9,7 @@
txt = ax1.annotate("test", (1., 1.), (0., 0),
arrowprops=dict(arrowstyle="->",
connectionstyle="angle3", lw=2),
- size=20, ha="center")
-
- txt.set_path_effects([PathEffects.withStroke(linewidth=3,
+ size=20, ha="center", path_effects=[PathEffects.withStroke(linewidth=3,
foreground="w")])
txt.arrow_patch.set_path_effects([
PathEffects.Stroke(linewidth=5, foreground="w"),
View
1  lib/matplotlib/collections.py
@@ -91,7 +91,6 @@ def __init__(self,
urls=None,
offset_position='screen',
zorder=1,
- path_effects=None,
**kwargs
):
"""
View
1  lib/matplotlib/lines.py
@@ -149,7 +149,6 @@ def __init__(self, xdata, ydata,
pickradius=5,
drawstyle=None,
markevery=None,
- path_effects = None,
**kwargs
):
"""
View
1  lib/matplotlib/patches.py
@@ -64,7 +64,6 @@ def __init__(self,
antialiased=None,
hatch=None,
fill=True,
- path_effects=None,
**kwargs):
"""
The following kwarg properties are supported
View
5 lib/matplotlib/tests/test_patheffects.py
@@ -13,9 +13,8 @@ def test_patheffect1():
txt = ax1.annotate("test", (1., 1.), (0., 0),
arrowprops=dict(arrowstyle="->",
connectionstyle="angle3", lw=2),
- size=20, ha="center")
-
- txt.set_path_effects([withStroke(linewidth=3,
+ size=20, ha="center",
+ path_effects=[withStroke(linewidth=3,
foreground="w")])
txt.arrow_patch.set_path_effects([Stroke(linewidth=5,
foreground="w"),
View
1  lib/matplotlib/text.py
@@ -158,7 +158,6 @@ def __init__(self,
rotation=None,
linespacing=None,
rotation_mode=None,
- path_effects=None,
**kwargs
):
"""
Something went wrong with that request. Please try again.