8000 allow fillstyle 'none' option by cragm · Pull Request #447 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

allow fillstyle 'none' option #447

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
merged 10 commits into from
Dec 31, 2011
Prev Previous commit
Next Next commit
Use local function to check for half-filled markers.
  • Loading branch information
cragm committed Dec 7, 2011
commit 9ac0f3d7bffdb8a74de7ff0838b65454df8feee3
24 changes: 15 additions & 9 deletions lib/matplotlib/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class MarkerStyle:
'o', 'v', '^', '<', '>', '8', 's', 'p', '*', 'h', 'H', 'D', 'd')

fillstyles = ('full', 'left' , 'right' , 'bottom' , 'top', 'none')
_half_fillstyles = ('left' , 'right' , 'bottom' , 'top')

# TODO: Is this ever used as a non-constant?
_point_size_reduction = 0.5
Expand Down Expand Up @@ -244,11 +245,16 @@ def _set_mathtext_path(self):
self._path = text
self._snap = False

def _half_fill(self):
fs = self.get_fillstyle()
result = fs in _half_fillstyles
return result

def _set_circle(self, reduction = 1.0):
self._transform = Affine2D().scale(0.5 * reduction)
self._snap_threshold = 3.0
fs = self.get_fillstyle()
if fs == 'full' or fs == 'none':
if not _half_fill():
self._path = Path.unit_circle()
else:
# build a right-half circle
Expand Down Expand Up @@ -290,7 +296,7 @@ def _set_triangle(self, rot, skip):
self._snap_threshold = 5.0
fs = self.get_fillstyle()

if fs == 'full' or fs == 'none':
if not _half_fill():
self._path = self._triangle_path
else:
mpaths = [self._triangle_path_u,
Expand Down Expand Up @@ -329,7 +335,7 @@ def _set_square(self):
self._transform = Affine2D().translate(-0.5, -0.5)
self._snap_threshold = 2.0
fs = self.get_fillstyle()
if fs == 'full' or fs == 'none':
if not _half_fill():
self._path = Path.unit_rectangle()
else:
# build a bottom filled square out of two rectangles, one
Expand All @@ -349,7 +355,7 @@ def _set_diamond(self):
self._transform = Affine2D().translate(-0.5, -0.5).rotate_deg(45)
self._snap_threshold = 5.0
fs = self.get_fillstyle()
if fs == 'full' or fs == 'none':
if not _half_fill():
self._path = Path.unit_rectangle()
else:
self._path = Path([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 0.0]])
Expand All @@ -374,7 +380,7 @@ def _set_pentagon(self):
polypath = Path.unit_regular_polygon(5)
fs = self.get_fillstyle()

if fs == 'full' or fs == 'none':
if not _half_fill():
self._path = polypath
else:
verts = polypath.vertices
Expand Down Expand Up @@ -404,7 +410,7 @@ def _set_star(self):
fs = self.get_fillstyle()
polypath = Path.unit_regular_star(5, innerCircle B6B6 =0.381966)

if fs == 'full' or fs == 'none':
if not _half_fill():
self._path = polypath
else:
verts = polypath.vertices
Expand Down Expand Up @@ -433,7 +439,7 @@ def _set_hexagon1(self):
fs = self.get_fillstyle()
polypath = Path.unit_regular_polygon(6)

if fs == 'full' or fs == 'none':
if not _half_fill():
self._path = polypath
else:
verts = polypath.vertices
Expand Down Expand Up @@ -465,7 +471,7 @@ def _set_hexagon2(self):
fs = self.get_fillstyle()
polypath = Path.unit_regular_polygon(6)

if fs == 'full' or fs == 'none':
if not _half_fill():
self._path = polypath
else:
verts = polypath.vertices
Expand Down Expand Up @@ -497,7 +503,7 @@ def _set_octagon(self):
fs = self.get_fillstyle()
polypath = Path.unit_regular_polygon(8)

if fs == 'full' or fs == 'none':
if not _half_fill():
self._transform.rotate_deg(22.5)
self._path = polypath
else:
Expand Down
0