martinjzhang / scDRS

Single-cell disease relevance score (scDRS)
https://martinjzhang.github.io/scDRS/
MIT License
98 stars 11 forks source link

plot_group_stats() got an unexpected keyword argument 'plot_kws' #65

Closed milospjanic closed 1 year ago

milospjanic commented 1 year ago

Hi,

I am getting this error when trying to plot. Using both scdrs 1.0.1 and 1.0.2


TypeError Traceback (most recent call last) Input In [23], in <cell line: 23>()

---> 23 fig, ax = scdrs.util.plot_group_stats( 24 dict_df_stats={ 25 trait: df_stats.rename(index=dict_celltype_display_name) 26 for trait, df_stats in dict_df_stats.items() 27 }, 28 plot_kws={ 29 "vmax": 0.2, 30 "cb_fraction":0.12 31 } 32 )

TypeError: plot_group_stats() got an unexpected keyword argument 'plot_kws'

martinjzhang commented 1 year ago

@KangchengHou could you help? Thanks!

KangchengHou commented 1 year ago

@milospjanic looks like it is a version mismatch issue.

Can you type

scdrs.__version__
??scdrs.util.plot_group_stats

to provide us some information on the scdrs version you are using?

To have a quick fix, I suggest installing scdrs=1.0.3 or remove plot_kws when calling plot_group_stats

milospjanic commented 1 year ago

scdrs.version '1.0.2'

milospjanic commented 1 year ago

Removing plot_kws works but then i cant adjust vmax for the coloring, and the graph ends up with no color (as the FDR proportions are lower)

milospjanic commented 1 year ago

and also the legend cover the top part of the graph image

KangchengHou commented 1 year ago

can you try reinstalling scdrs=1.0.3 so you can have more control on the figure aesthetics via plot_kws

milospjanic commented 1 year ago

How do i get 1.0.3, pip install scdrs==1.0.3 doesnt work

milospjanic commented 1 year ago

Also via cloning the repository doesnt work

KangchengHou commented 1 year ago
pip install git+https://github.com/martinjzhang/scDRS.git
milospjanic commented 1 year ago

Thanks with 1.0.3 it looks good as the bar is above the graph, but still I cant change vmax to 0.05 to get some color on the graph, changing vmax in plot_kws doesnt change it image

KangchengHou commented 1 year ago

can you try setting cb_vmax? the full option is available at https://github.com/martinjzhang/scDRS/blob/6ee2161820fc9141eb1f85512659eef1c05d0d66/scdrs/util.py#L492

milospjanic commented 1 year ago

works now, thanks! image

wy-cmd commented 3 months ago

Hello everyone, I would like to ask how to view the complete heatmap results. When I use the code below to create a heatmap, no matter how I set the canvas size for saving, I can't see the entire image. Could you please give me some advice? Thank you very much. Just to let you know, I am using the latest version, v1.03.

` fig, ax = scdrs.util.plot_group_stats( dict_df_stats={ trait: df_stats.rename(index=dict_celltype_display_name) for trait, df_stats in dict_df_stats.items() },

plot_kws={
    "cb_vmax": 0.2,
    "cb_fraction":0.1,
}

)

fig.set_size_inches(8, 10) plt.savefig("Figure2.png") plt.close(fig) `

When I do not set the image size, the result is as shown in Figure 1. However, when I set the image size, the result is as shown in Figure 2. Figure1 Figure2

KangchengHou commented 3 months ago

Could you try plt.savefig("Figure2.png", bbox_inches='tight')

wy-cmd commented 3 months ago

Could you try plt.savefig("Figure2.png", bbox_inches='tight')

Thanks a lot! The image turned out great, nothing got cut off. Figure2