Skip to content

Commit

Permalink
modified: metax/taxafunc_ploter/basic_plot.py
Browse files Browse the repository at this point in the history
  • Loading branch information
byemaxx committed Dec 4, 2024
1 parent 807ddb0 commit 9f0fc74
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions metax/taxafunc_ploter/basic_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ def plot_corr_sns(
theme: str = None,
cmap: str = "Auto",
rename_sample: bool = False,
corr_method: str = "pearson",
):
dft= df.copy()
if rename_sample:
Expand All @@ -394,7 +395,12 @@ def plot_corr_sns(
cmap = cmap

color_list = self.assign_colors(group_list)
corr = dft.corr()

# check if the correlation method is valid
if corr_method not in ['pearson', 'spearman', 'kendall']:
raise ValueError(f"Invalid correlation method: {corr_method}. Please choose from 'pearson', 'spearman', or 'kendall'.")

corr = dft.corr(method=corr_method)
# mask = np.triu(np.ones_like(corr, dtype=bool))

try:
Expand Down Expand Up @@ -430,7 +436,8 @@ def plot_corr_sns(
fig.ax_col_dendrogram.set_title(f'Correlation of {title_name}', fontsize=font_size+2, fontweight='bold')

cbar = fig.ax_heatmap.collections[0].colorbar
cbar.set_label('Intensity', rotation=90, labelpad=1)
cbar.set_label('correlation',
rotation=90, labelpad=1)
cbar.ax.yaxis.set_ticks_position('left')
cbar.ax.yaxis.set_label_position('left')
plt.subplots_adjust(left=0.03, bottom=0.095, right=0.5, top=0.96, wspace=0.01, hspace=0.01)
Expand Down

0 comments on commit 9f0fc74

Please sign in to comment.