Skip to content

Commit

Permalink
Use same offset at both ends of bent line and make the line bends up …
Browse files Browse the repository at this point in the history
…for large jitter_bounds.
  • Loading branch information
pontushojer committed May 28, 2023
1 parent 575dc9f commit 202b103
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions samplot/samplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1846,13 +1846,14 @@ def plot_long_reads(long_reads, ax, ranges, curr_min_insert_size, curr_max_inser
else:
x1 = p[0]
x2 = p[1]

# get offset to bend the line up
max_gap_offset = max(jitter(max_gap * 1.1, bounds=jitter_bounds), max_gap)
pp = mpatches.PathPatch(
Path(
[
(x1, max_gap),
(x1, jitter(max_gap * 1.1, bounds=jitter_bounds)),
(x2, jitter(max_gap * 1.1, bounds=jitter_bounds)),
(x1, max_gap_offset),
(x2, max_gap_offset),
(x2, max_gap),
],
[Path.MOVETO, Path.CURVE4, Path.CURVE4, Path.CURVE4],
Expand All @@ -1866,7 +1867,7 @@ def plot_long_reads(long_reads, ax, ranges, curr_min_insert_size, curr_max_inser
ax.add_patch(pp)

# add some room for the bend line
curr_max_insert_size = max(curr_max_insert_size, max_gap * 1.1)
curr_max_insert_size = max(curr_max_insert_size, max_gap_offset)

return [curr_min_insert_size, curr_max_insert_size]

Expand Down

0 comments on commit 202b103

Please sign in to comment.