Skip to content

Commit 4f26368

Browse files
committed
fix(line_segment): use overloaded edge_style in mpl_plot instead of generating a new one
1 parent f10c6d9 commit 4f26368

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.23.1]
9+
10+
### Fix
11+
12+
- LineSegment2D : If it is overloaded, MPL Plot now show the right edge_style instead of generating of random one
13+
814
## [0.23.0]
915

1016
### Feat

plot_data/core.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ def mpl_plot(self, ax=None, edge_style=None, **kwargs):
494494
if ax is None:
495495
_, ax = plt.subplots()
496496

497-
style = self.edge_style
498497
if edge_style:
499498
style = edge_style
500499
color = style.color_stroke.rgb
@@ -525,9 +524,8 @@ def __init__(self, point1: List[float], point2: List[float], edge_style: EdgeSty
525524
self.point2 = point2
526525

527526
if edge_style is None:
528-
self.edge_style = EdgeStyle()
529-
else:
530-
self.edge_style = edge_style
527+
edge_style = EdgeStyle()
528+
self.edge_style = edge_style
531529
super().__init__(type_='linesegment2d', reference_path=reference_path, name=name)
532530

533531
def bounding_box(self):
@@ -546,10 +544,11 @@ def mpl_plot(self, ax=None, edge_style=None, **kwargs):
546544
if not ax:
547545
_, ax = plt.subplots()
548546

549-
if edge_style:
550-
edge_style = self.edge_style
551-
else:
552-
edge_style = DEFAULT_EDGESTYLE
547+
if edge_style is None:
548+
if self.edge_style:
549+
edge_style = self.edge_style
550+
else:
551+
edge_style = DEFAULT_EDGESTYLE
553552

554553
ax.plot([self.point1[0], self.point2[0]], [self.point1[1], self.point2[1]], **edge_style.mpl_arguments(),
555554
**kwargs)
@@ -628,7 +627,6 @@ def mpl_plot(self, ax=None, **kwargs):
628627
edge_style = self.edge_style
629628
else:
630629
edge_style = DEFAULT_EDGESTYLE
631-
# dashes = DEFAULT_EDGESTYLE.dashline
632630
args = edge_style.mpl_arguments(surface=True)
633631
if 'dashes' in args:
634632
args.pop("dashes")
@@ -670,7 +668,6 @@ def mpl_plot(self, ax=None, **kwargs):
670668
edge_style = self.edge_style
671669
else:
672670
edge_style = DEFAULT_EDGESTYLE
673-
# dashes = DEFAULT_EDGESTYLE.dashline
674671
args = edge_style.mpl_arguments(surface=True)
675672
if 'dashes' in args:
676673
args.pop("dashes")

0 commit comments

Comments
 (0)