From 6f2468714381c0519e4de21a31349df484ad35d0 Mon Sep 17 00:00:00 2001 From: Yuuki Galaxy Date: Thu, 16 May 2024 19:25:13 +0800 Subject: [PATCH] modified: diffout.py --- python/salus/dfcorr/diffout.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/python/salus/dfcorr/diffout.py b/python/salus/dfcorr/diffout.py index 3ceb46da8..91e4a8f59 100755 --- a/python/salus/dfcorr/diffout.py +++ b/python/salus/dfcorr/diffout.py @@ -1,6 +1,17 @@ #!/usr/bin/env python3 +import numpy as np +import matplotlib as mpl +import matplotlib.pyplot as plt +from matplotlib.backends.backend_pdf import PdfPages +mpl.rcdefaults() +mpl.rc('ps', fonttype=42, papersize='figure') +mpl.rc('pdf', fonttype=42, compression=9) #pdf.fonttype: 3 # Output Type 3 (Type3) or Type 42 (TrueType) +mpl.rc('figure', figsize=(129/25.4, 129/25.4), dpi=600) # autolayout=True +mpl.rc('savefig', dpi='figure') # bbox='tight' + import pandas as pd +import seaborn as sns def qw(s): return tuple(s.split()) @@ -13,9 +24,22 @@ diffcorr=diffout.corr() # micromamba install zstandard factors = qw('Elongating Endothelial InnateLymph Leydig Macrophage Myoid SPG STids Scytes Sertoli Unknown') +pdf = PdfPages(f'{prefix}diffout.pdf') for onefactor in factors: colids = [] colids.append(f"{onefactor}_1") colids.append(f"{onefactor}_2") onecorr = diffcorr[colids[0]][colids[1]] print(f'{onefactor}: {onecorr}') + tmpDF=pd.DataFrame() + tmpDF['rank1']=diffout[colids[0]].rank() + tmpDF['rank2']=diffout[colids[1]].rank() + tmpDF[colids[0]]=diffout[colids[0]] + tmpDF[colids[1]]=diffout[colids[1]] + plt.figure() + sns.jointplot(data=tmpDF, x=colids[0], y=colids[1],kind="scatter",marginal_ticks=True,s=1) + fig.suptitle(f'Corr: {onecorr}') + pdf.savefig() + plt.close() +pdf.close() +print(f'.\n[i]Done.', flush=True) -- 2.11.4.GIT