Skip to content

Commit

Permalink
BLK100
Browse files Browse the repository at this point in the history
  • Loading branch information
zqfang committed Aug 18, 2022
1 parent 80537b3 commit eeee82c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions gseapy/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,16 +639,19 @@ def ringplot(
df = df.assign(p_inv=np.log(1 / df[colname]))
colname = "p_inv"
cbar_title = r"$Log \frac{1}{P val}$"


if (x is not None) and (x in df.columns):
# get top term of each group
df = df.groupby(x).apply(lambda x : x.sort_values(by = colname).tail(top_term)).reset_index(drop = True)
df = (
df.groupby(x)
.apply(lambda x: x.sort_values(by=colname).tail(top_term))
.reset_index(drop=True)
)
else:
df = df.sort_values(by=colname).tail(top_term)

xlabel = ""
# set xaxis values, so you could get dotplot
# set xaxis values, so you could get dotplot
if (x is not None) and (x in df.columns):
xlabel = x
elif "Combined Score" in df.columns:
Expand All @@ -661,7 +664,7 @@ def ringplot(
# revert back to p_inv
x = colname
xlabel = cbar_title

# get scatter area
temp = df["Overlap"].str.split("/", expand=True).astype(int)
df = df.assign(Hits_ratio=temp.iloc[:, 0] / temp.iloc[:, 1])
Expand Down Expand Up @@ -709,7 +712,10 @@ def ringplot(
# ax.set_xlabel(xlabel, fontsize=14, fontweight="bold")
# ax.yaxis.set_major_locator(plt.FixedLocator(y))
# ax.yaxis.set_major_formatter(plt.FixedFormatter(ylabels))
ax.xaxis.set_tick_params(labelsize=14, labelrotation = 90,)
ax.xaxis.set_tick_params(
labelsize=14,
labelrotation=90,
)
ax.yaxis.set_tick_params(labelsize=16)
ax.set_axisbelow(True) # set grid blew other element
ax.grid(axis="both") # zorder=-1.0
Expand Down

0 comments on commit eeee82c

Please sign in to comment.