Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ebf81db

Browse files
committed
Merge pull request #5586 from mdboom/errorbar-extension-arrows
Fix errorbar extension arrows
1 parent 559b59e commit ebf81db

File tree

9 files changed

+878
-838
lines changed

9 files changed

+878
-838
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2923,9 +2923,9 @@ def xywhere(xs, ys, mask):
29232923
barcols.append(self.hlines(yo, lo, ro, **lines_kw))
29242924
rightup, yup = xywhere(right, y, xlolims & everymask)
29252925
if self.xaxis_inverted():
2926-
marker = mlines.CARETLEFT
2926+
marker = mlines.CARETLEFTBASE
29272927
else:
2928-
marker = mlines.CARETRIGHT
2928+
marker = mlines.CARETRIGHTBASE
29292929
caplines.extend(
29302930
self.plot(rightup, yup, ls='None', marker=marker,
29312931
**plot_kw))
@@ -2939,9 +2939,9 @@ def xywhere(xs, ys, mask):
29392939
barcols.append(self.hlines(yo, lo, ro, **lines_kw))
29402940
leftlo, ylo = xywhere(left, y, xuplims & everymask)
29412941
if self.xaxis_inverted():
2942-
marker = mlines.CARETRIGHT
2942+
marker = mlines.CARETRIGHTBASE
29432943
else:
2944-
marker = mlines.CARETLEFT
2944+
marker = mlines.CARETLEFTBASE
29452945
caplines.extend(
29462946
self.plot(leftlo, ylo, ls='None', marker=marker,
29472947
**plot_kw))
@@ -2987,9 +2987,9 @@ def xywhere(xs, ys, mask):
29872987
barcols.append(self.vlines(xo, lo, uo, **lines_kw))
29882988
xup, upperup = xywhere(x, upper, lolims & everymask)
29892989
if self.yaxis_inverted():
2990-
marker = mlines.CARETDOWN
2990+
marker = mlines.CARETDOWNBASE
29912991
else:
2992-
marker = mlines.CARETUP
2992+
marker = mlines.CARETUPBASE
29932993
caplines.extend(
29942994
self.plot(xup, upperup, ls='None', marker=marker,
29952995
**plot_kw))
@@ -3003,9 +3003,9 @@ def xywhere(xs, ys, mask):
30033003
barcols.append(self.vlines(xo, lo, uo, **lines_kw))
30043004
xlo, lowerlo = xywhere(x, lower, uplims & everymask)
30053005
if self.yaxis_inverted():
3006-
marker = mlines.CARETUP
3006+
marker = mlines.CARETUPBASE
30073007
else:
3008-
marker = mlines.CARETDOWN
3008+
marker = mlines.CARETDOWNBASE
30093009
caplines.extend(
30103010
self.plot(xlo, lowerlo, ls='None', marker=marker,
30113011
**plot_kw))

lib/matplotlib/lines.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
# Imported here for backward compatibility, even though they don't
3131
# really belong.
3232
from matplotlib.markers import TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN
33-
from matplotlib.markers import CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN
33+
from matplotlib.markers import (
34+
CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN,
35+
CARETLEFTBASE, CARETRIGHTBASE, CARETUPBASE, CARETDOWNBASE)
3436

3537

3638
def segment_hits(cx, cy, x, y, radius):

lib/matplotlib/markers.py

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,13 @@
3535
TICKRIGHT tickright
3636
TICKUP tickup
3737
TICKDOWN tickdown
38-
CARETLEFT caretleft
39-
CARETRIGHT caretright
40-
CARETUP caretup
41-
CARETDOWN caretdown
38+
CARETLEFT caretleft (centered at tip)
39+
CARETRIGHT caretright (centered at tip)
40+
CARETUP caretup (centered at tip)
41+
CARETDOWN caretdown (centered at tip)
42+
CARETLEFTBASE caretleft (centered at base)
43+
CARETRIGHTBASE caretright (centered at base)
44+
CARETUPBASE caretup (centered at base)
4245
"None" nothing
4346
None nothing
4447
" " nothing
@@ -91,7 +94,8 @@
9194

9295
# special-purpose marker identifiers:
9396
(TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN,
94-
CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN) = list(xrange(8))
97+
CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN,
98+
CARETLEFTBASE, CARETRIGHTBASE, CARETUPBASE, CARETDOWNBASE) = list(xrange(12))
9599

96100

97101
class MarkerStyle(object):
@@ -128,6 +132,10 @@ class MarkerStyle(object):
128132
CARETRIGHT: 'caretright',
129133
CARETUP: 'caretup',
130134
CARETDOWN: 'caretdown',
135+
CARETLEFTBASE: 'caretleftbase',
136+
CARETRIGHTBASE: 'caretrightbase',
137+
CARETUPBASE: 'caretupbase',
138+
CARETDOWNBASE: 'caretdownbase',
131139
"None": 'nothing',
132140
None: 'nothing',
133141
' ': 'nothing',
@@ -779,6 +787,36 @@ def _set_caretright(self):
779787
self._path = self._caret_path
780788
self._joinstyle = 'miter'
781789

790+
_caret_path_base = Path([[-1.0, 0.0], [0.0, -1.5], [1.0, 0]])
791+
792+
def _set_caretdownbase(self):
793+
self._transform = Affine2D().scale(0.5)
794+
self._snap_threshold = 3.0
795+
self._filled = False
796+
self._path = self._caret_path_base
797+
self._joinstyle = 'miter'
798+
799+
def _set_caretupbase(self):
800+
self._transform = Affine2D().scale(0.5).rotate_deg(180)
801+
self._snap_threshold = 3.0
802+
self._filled = False
803+
self._path = self._caret_path_base
804+
self._joinstyle = 'miter'
805+
806+
def _set_caretleftbase(self):
807+
self._transform = Affine2D().scale(0.5).rotate_deg(270)
808+
self._snap_threshold = 3.0
809+
self._filled = False
810+
self._path = self._caret_path_base
811+
self._joinstyle = 'miter'
812+
813+
def _set_caretrightbase(self):
814+
self._transform = Affine2D().scale(0.5).rotate_deg(90)
815+
self._snap_threshold = 3.0
816+
self._filled = False
817+
self._path = self._caret_path_base
818+
self._joinstyle = 'miter'
819+
782820
_x_path = Path([[-1.0, -1.0], [1.0, 1.0],
783821
[-1.0, 1.0], [1.0, -1.0]],
784822
[Path.MOVETO, Path.LINETO,
Binary file not shown.

0 commit comments

Comments
 (0)