Skip to content

Improve Line2D and MarkerStyle instantiation #6694

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all 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
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