ACCLAB / DABEST-python

Data Analysis with Bootstrapped ESTimation
https://acclab.github.io/DABEST-python/
Apache License 2.0
341 stars 47 forks source link

contrast_ylim does not work for matplotlib #128

Closed CalvinChad closed 8 months ago

CalvinChad commented 2 years ago

Hi, Im running the code in jupyter lab (python) in order to produce gardiner-altman plots, but for some reason contrast_ylim does not set the y limits. Am I missing something, or is there an issue?

my_color_palette = {"WT" : "black", "K$_V$2.1$^{OFF}$" : "grey"}

f, axx = plt.subplots(nrows=2, ncols=2, figsize=(7,5),gridspec_kw={'wspace': 0.6, 'hspace':0.5 })

Res = dabest.load(Gxtx_ALL_Mature, idx=("WT","K$_V$2.1$^{OFF}$"),x="rel_cond", y="Res_Mohm",id_col="Cell_ID") Cap = dabest.load(Gxtx_ALL_Mature, idx=("WT","K$_V$2.1$^{OFF}$"),x="rel_cond", y="Cap_pF",id_col="Cell_ID") Rheo = dabest.load(Gxtx_ALL_Mature, idx=("WT","K$_V$2.1$^{OFF}$"),x="rel_cond", y="Rheo_nA",id_col="Cell_ID") RMP = dabest.load(Gxtx_ALL_Mature, idx=("WT","K$_V$2.1$^{OFF}$"),x="rel_cond", y="RMP",id_col="Cell_ID")

Res.hedges_g.plot(ax=axx.flat[0],swarm_label='Resistance (MOhm)', es_marker_size=4, raw_marker_size=3.5,custom_palette=my_color_palette, contrast_label='effect size (Hedges g)', swarm_ylim=(0,60), contrast_ylim=(-1,1)); Cap.hedges_g.plot(ax=axx.flat[1],swarm_label='Capacitance (pF)', es_marker_size=4, raw_marker_size=3.5, custom_palette=my_color_palette, contrast_label='effect size (Hedges g)', swarm_ylim=(0,1000),contrast_ylim=(-1,1)); Rheo.hedges_g.plot(ax=axx.flat[2],swarm_label='Rheobase (nA)', es_marker_size=4, raw_marker_size=3.5, custom_palette=my_color_palette, contrast_label='effect size (Hedges g)', swarm_ylim=(0,4),contrast_ylim=(-1,1)); RMP.hedges_g.plot(ax=axx.flat[3],swarm_label='RMP (mV)', es_marker_size=4, raw_marker_size=3.5, custom_palette=my_color_palette, contrast_label='effect size (Hedges g)',swarm_ylim=(-100,-40), contrast_ylim=(-1,1)) Con_KO_membrane_esPlot

ZHANGROU-99 commented 1 year ago

Hi, @CalvinChad . Thank you for your question. Currently you can only customize ylim for cumming plot. For Gardner-Altman plot, ylim of CI is auto scaled and cannot be customized. You can set 'float_contrast=False' for cumming plot. Hope this helps!