Skip to content

Commit

Permalink
Fix #91
Browse files Browse the repository at this point in the history
  • Loading branch information
veghp committed Jan 9, 2025
1 parent 990b201 commit b561588
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions dna_features_viewer/GraphicRecord/MatplotlibPlottableMixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,12 @@ def plot_feature(self, ax, feature, level, linewidth=1.0):
head_length = 0.001
else:
width_pixel = self._get_ax_width(ax, unit="pixel")
head_length = 0.5 * width_pixel * feature.length / self.sequence_length
head_length = (
0.5
* width_pixel
* feature.length
/ (ax.get_xlim()[1] - ax.get_xlim()[0])
)
head_length = min(head_length, 0.6 * feature.thickness)

arrowstyle = mpatches.ArrowStyle.Simple(
Expand Down Expand Up @@ -274,7 +279,7 @@ def place_annotation(
max_label_length,
indicate_strand_in_label=False,
):
""""Place an annotation in the figure. Decide on inline vs. outline.
""" "Place an annotation in the figure. Decide on inline vs. outline.
Parameters
----------
Expand Down Expand Up @@ -464,7 +469,16 @@ def strand_in_label(f):
self.plot_feature(ax=ax, feature=feature, level=level)
if feature.label is None:
continue
(text, overflowing, nlines, (x1, x2,), height,) = self.place_annotation(
(
text,
overflowing,
nlines,
(
x1,
x2,
),
height,
) = self.place_annotation(
feature=feature,
ax=ax,
level=level,
Expand Down Expand Up @@ -573,10 +587,17 @@ def plot_legend(
text = feature.legend_text
if text is None:
continue
parameters = dict(label=text, facecolor=feature.color, edgecolor="black",)
parameters = dict(
label=text,
facecolor=feature.color,
edgecolor="black",
)
if include_edge:
parameters.update(
dict(linewidth=feature.linewidth, edgecolor=feature.linecolor,)
dict(
linewidth=feature.linewidth,
edgecolor=feature.linecolor,
)
)
if text in features_parameters:
previous_parameters = features_parameters[text]
Expand Down

0 comments on commit b561588

Please sign in to comment.