Skip to content

Commit

Permalink
Merge pull request #5586 from mdboom/errorbar-extension-arrows
Browse files Browse the repository at this point in the history
Fix errorbar extension arrows
  • Loading branch information
jenshnielsen committed Dec 15, 2015
1 parent 559b59e commit ebf81db
Show file tree
Hide file tree
Showing 9 changed files with 878 additions and 838 deletions.
16 changes: 8 additions & 8 deletions lib/matplotlib/axes/_axes.py
Expand Up @@ -2923,9 +2923,9 @@ def xywhere(xs, ys, mask):
barcols.append(self.hlines(yo, lo, ro, **lines_kw))
rightup, yup = xywhere(right, y, xlolims & everymask)
if self.xaxis_inverted():
marker = mlines.CARETLEFT
marker = mlines.CARETLEFTBASE
else:
marker = mlines.CARETRIGHT
marker = mlines.CARETRIGHTBASE
caplines.extend(
self.plot(rightup, yup, ls='None', marker=marker,
**plot_kw))
Expand All @@ -2939,9 +2939,9 @@ def xywhere(xs, ys, mask):
barcols.append(self.hlines(yo, lo, ro, **lines_kw))
leftlo, ylo = xywhere(left, y, xuplims & everymask)
if self.xaxis_inverted():
marker = mlines.CARETRIGHT
marker = mlines.CARETRIGHTBASE
else:
marker = mlines.CARETLEFT
marker = mlines.CARETLEFTBASE
caplines.extend(
self.plot(leftlo, ylo, ls='None', marker=marker,
**plot_kw))
Expand Down Expand Up @@ -2987,9 +2987,9 @@ def xywhere(xs, ys, mask):
barcols.append(self.vlines(xo, lo, uo, **lines_kw))
xup, upperup = xywhere(x, upper, lolims & everymask)
if self.yaxis_inverted():
marker = mlines.CARETDOWN
marker = mlines.CARETDOWNBASE
else:
marker = mlines.CARETUP
marker = mlines.CARETUPBASE
caplines.extend(
self.plot(xup, upperup, ls='None', marker=marker,
**plot_kw))
Expand All @@ -3003,9 +3003,9 @@ def xywhere(xs, ys, mask):
barcols.append(self.vlines(xo, lo, uo, **lines_kw))
xlo, lowerlo = xywhere(x, lower, uplims & everymask)
if self.yaxis_inverted():
marker = mlines.CARETUP
marker = mlines.CARETUPBASE
else:
marker = mlines.CARETDOWN
marker = mlines.CARETDOWNBASE
caplines.extend(
self.plot(xlo, lowerlo, ls='None', marker=marker,
**plot_kw))
Expand Down
4 changes: 3 additions & 1 deletion lib/matplotlib/lines.py
Expand Up @@ -30,7 +30,9 @@
# Imported here for backward compatibility, even though they don't
# really belong.
from matplotlib.markers import TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN
from matplotlib.markers import CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN
from matplotlib.markers import (
CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN,
CARETLEFTBASE, CARETRIGHTBASE, CARETUPBASE, CARETDOWNBASE)


def segment_hits(cx, cy, x, y, radius):
Expand Down
48 changes: 43 additions & 5 deletions lib/matplotlib/markers.py
Expand Up @@ -35,10 +35,13 @@
TICKRIGHT tickright
TICKUP tickup
TICKDOWN tickdown
CARETLEFT caretleft
CARETRIGHT caretright
CARETUP caretup
CARETDOWN caretdown
CARETLEFT caretleft (centered at tip)
CARETRIGHT caretright (centered at tip)
CARETUP caretup (centered at tip)
CARETDOWN caretdown (centered at tip)
CARETLEFTBASE caretleft (centered at base)
CARETRIGHTBASE caretright (centered at base)
CARETUPBASE caretup (centered at base)
"None" nothing
None nothing
" " nothing
Expand Down Expand Up @@ -91,7 +94,8 @@

# special-purpose marker identifiers:
(TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN,
CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN) = list(xrange(8))
CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN,
CARETLEFTBASE, CARETRIGHTBASE, CARETUPBASE, CARETDOWNBASE) = list(xrange(12))


class MarkerStyle(object):
Expand Down Expand Up @@ -128,6 +132,10 @@ class MarkerStyle(object):
CARETRIGHT: 'caretright',
CARETUP: 'caretup',
CARETDOWN: 'caretdown',
CARETLEFTBASE: 'caretleftbase',
CARETRIGHTBASE: 'caretrightbase',
CARETUPBASE: 'caretupbase',
CARETDOWNBASE: 'caretdownbase',
"None": 'nothing',
None: 'nothing',
' ': 'nothing',
Expand Down Expand Up @@ -779,6 +787,36 @@ def _set_caretright(self):
self._path = self._caret_path
self._joinstyle = 'miter'

_caret_path_base = Path([[-1.0, 0.0], [0.0, -1.5], [1.0, 0]])

def _set_caretdownbase(self):
self._transform = Affine2D().scale(0.5)
self._snap_threshold = 3.0
self._filled = False
self._path = self._caret_path_base
self._joinstyle = 'miter'

def _set_caretupbase(self):
self._transform = Affine2D().scale(0.5).rotate_deg(180)
self._snap_threshold = 3.0
self._filled = False
self._path = self._caret_path_base
self._joinstyle = 'miter'

def _set_caretleftbase(self):
self._transform = Affine2D().scale(0.5).rotate_deg(270)
self._snap_threshold = 3.0
self._filled = False
self._path = self._caret_path_base
self._joinstyle = 'miter'

def _set_caretrightbase(self):
self._transform = Affine2D().scale(0.5).rotate_deg(90)
self._snap_threshold = 3.0
self._filled = False
self._path = self._caret_path_base
self._joinstyle = 'miter'

_x_path = Path([[-1.0, -1.0], [1.0, 1.0],
[-1.0, 1.0], [1.0, -1.0]],
[Path.MOVETO, Path.LINETO,
Expand Down
Binary file not shown.
Binary file modified lib/matplotlib/tests/baseline_images/test_axes/errorbar_limits.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ebf81db

Please sign in to comment.