Skip to content

Commit

Permalink
fixed hits alignment #222
Browse files Browse the repository at this point in the history
  • Loading branch information
zqfang committed Aug 24, 2023
1 parent a081e88 commit 4519a48
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion gseapy/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,20 @@ def axes_hits(self, rect, bottom: bool = False):
ax2 = self.fig.add_axes(rect)
# the x coords of this transformation are data, and the y coord are axes
trans2 = transforms.blended_transform_factory(ax2.transData, ax2.transAxes)
# to make axes shared with same x cooridincates, make the vlines same ranges to x
ax2.vlines([self._x[0], self._x[-1]], 0, 1,
linewidth=0.5,
transform=trans2,
color='white',
alpha=0) # alpha 0 to transparency
# add hits line
ax2.vlines(
self._hit_indices, 0, 1, linewidth=0.5, transform=trans2, color=self.color
self._hit_indices, 0, 1,
linewidth=0.5,
transform=trans2,
color='black'
)

ax2.tick_params(
axis="both",
which="both",
Expand Down Expand Up @@ -1309,6 +1320,12 @@ def axes_hits(
ax2 = self.fig.add_axes(rect)
# the x coords of this transformation are data, and the y coord are axes
trans2 = transforms.blended_transform_factory(ax2.transData, ax2.transAxes)
# align hits to runes
ax2.vlines([0, len(self.runes) -1], 0, 1,
linewidth=0.5,
transform=trans2,
color='white',
alpha=0) # alpha 0 to transparency
ax2.vlines(tags, 0, 1, linewidth=0.5, transform=trans2, color=color)
ax2.spines["bottom"].set_visible(True)
ax2.tick_params(
Expand Down

0 comments on commit 4519a48

Please sign in to comment.