Skip to content

Commit

Permalink
Merge pull request matplotlib#6694 from Kojoley/improve-line2d-and-ma…
Browse files Browse the repository at this point in the history
…rkerstyle-instantiation

MNT: refactor Line2D and MarkerStyle instantiation
  • Loading branch information
tacaswell authored Jul 12, 2016
2 parents a578a7a + 486ce4d commit 7f4e84c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
5 changes: 1 addition & 4 deletions lib/matplotlib/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,7 @@ def __init__(self, xdata, ydata,

self._color = None
self.set_color(color)
self._marker = MarkerStyle()
self.set_marker(marker)
self._marker = MarkerStyle(marker, fillstyle)

self._markevery = None
self._markersize = None
Expand All @@ -391,8 +390,6 @@ def __init__(self, xdata, ydata,
self.set_markeredgecolor(markeredgecolor)
self.set_markeredgewidth(markeredgewidth)

self.set_fillstyle(fillstyle)

self.verticalOffset = None

# update kwargs before updating data to give the caller a
Expand Down
9 changes: 4 additions & 5 deletions lib/matplotlib/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,9 @@ def __init__(self, marker=None, fillstyle=None):
fillstyle : string, optional, default: 'full'
'full', 'left", 'right', 'bottom', 'top', 'none'
"""
# The fillstyle has to be set here as it might be accessed by calls to
# _recache() in set_marker.
self._fillstyle = fillstyle
self.set_marker(marker)
self._marker_function = None
self.set_fillstyle(fillstyle)
self.set_marker(marker)

def __getstate__(self):
d = self.__dict__.copy()
Expand All @@ -189,9 +187,10 @@ def __getstate__(self):
def __setstate__(self, statedict):
self.__dict__ = statedict
self.set_marker(self._marker)
self._recache()

def _recache(self):
if self._marker_function is None:
return
self._path = _empty_path
self._transform = IdentityTransform()
self._alt_path = None
Expand Down

0 comments on commit 7f4e84c

Please sign in to comment.