Skip to content

Commit f4ec0e2

Browse files
committed
Cleanup, bug fix, begin merge overlapping arrows
1 parent 75e52b0 commit f4ec0e2

File tree

1 file changed

+37
-11
lines changed

1 file changed

+37
-11
lines changed

lib/mpl_toolkits/axes_grid1/anchored_artists.py

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,10 @@ class AnchoredDirectionArrows(AnchoredOffsetbox):
379379
@docstring.dedent
380380
def __init__(self, transform, label_x, label_y, length=0.15,
381381
fontsize=0.08, loc=2, angle=0, aspect_ratio=1, pad=0.1,
382-
borderpad=0.1, frameon=False, color='black', alpha=1,
382+
borderpad=0.1, frameon=False, color='w', alpha=1,
383383
sep_x=0.01,sep_y=0, fontproperties=None, back_length=0.15,
384384
head_width=10, head_length=15, tail_width=2,
385-
lw=0.5, text_props={}, arrow_props={},
385+
text_props=None, arrow_props=None,
386386
**kwargs):
387387
"""
388388
Draw a direction indicator arrows
@@ -479,6 +479,12 @@ def __init__(self, transform, label_x, label_y, length=0.15,
479479
size_vertical=0.5, color='white', \
480480
fontproperties=fontprops)
481481
"""
482+
if arrow_props is None:
483+
arrow_props = {}
484+
485+
if text_props is None:
486+
text_props = {}
487+
482488
arrowstyle = ArrowStyle("Simple",
483489
head_width=head_width,
484490
head_length=head_length,
@@ -487,6 +493,8 @@ def __init__(self, transform, label_x, label_y, length=0.15,
487493
if fontproperties is None and 'prop' in kwargs:
488494
fontproperties = kwargs.pop('prop')
489495

496+
print(bool(arrow_props))
497+
490498
if 'color' not in arrow_props:
491499
arrow_props['color'] = color
492500

@@ -495,14 +503,10 @@ def __init__(self, transform, label_x, label_y, length=0.15,
495503

496504
if 'color' not in text_props:
497505
text_props['color'] = color
498-
text_props['ec'] = color
499506

500507
if 'alpha' not in text_props:
501508
text_props['alpha'] = alpha
502509

503-
if 'lw' not in text_props:
504-
text_props['lw'] = lw
505-
506510
t_start = transform
507511
t = transforms.Affine2D().rotate_deg(angle)
508512
t_end = t_start + t
@@ -513,29 +517,51 @@ def __init__(self, transform, label_x, label_y, length=0.15,
513517
length_x = length
514518
length_y = length*aspect_ratio
515519

516-
self.arrow_x = FancyArrowPatch(
520+
self.arrow_x_face = FancyArrowPatch(
521+
(0,back_length*length_y),
522+
(length_x,back_length*length_y),
523+
arrowstyle=arrowstyle,
524+
shrinkA=0.0,
525+
shrinkB=0.0,
526+
**arrow_props)
527+
self.arrow_x_face.set_ec('None')
528+
529+
self.arrow_x_edge = FancyArrowPatch(
517530
(0,back_length*length_y),
518531
(length_x,back_length*length_y),
519532
arrowstyle=arrowstyle,
520533
shrinkA=0.0,
521534
shrinkB=0.0,
522535
**arrow_props)
536+
self.arrow_x_edge.set_fc('None')
537+
538+
self.arrow_y_face = FancyArrowPatch(
539+
(back_length*length_x,0),
540+
(back_length*length_x,length_y),
541+
arrowstyle=arrowstyle,
542+
shrinkA=0.0,
543+
shrinkB=0.0,
544+
**arrow_props)
545+
self.arrow_y_face.set_ec('None')
523546

524-
self.arrow_y = FancyArrowPatch(
547+
self.arrow_y_edge = FancyArrowPatch(
525548
(back_length*length_x,0),
526549
(back_length*length_x,length_y),
527550
arrowstyle=arrowstyle,
528551
shrinkA=0.0,
529552
shrinkB=0.0,
530553
**arrow_props)
554+
self.arrow_y_edge.set_fc('None')
531555

532-
self._box.add_artist(self.arrow_x)
533-
self._box.add_artist(self.arrow_y)
556+
self._box.add_artist(self.arrow_x_edge)
557+
self._box.add_artist(self.arrow_y_edge)
558+
self._box.add_artist(self.arrow_x_face)
559+
self._box.add_artist(self.arrow_y_face)
534560

535561
#Label X
536562
text_path_x = TextPath((
537563
length_x+sep_x, back_length*length_y+sep_y), label_x,
538-
size=fontsize, prop=fontproperties, roatation=angle)
564+
size=fontsize, prop=fontproperties)
539565
self.p_x = PathPatch(text_path_x, transform=t_start, **text_props)
540566
self._box.add_artist(self.p_x)
541567

0 commit comments

Comments
 (0)