#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import forestplot as fp # ## Top of plot should not be getting cut off # See issue [#47](https://github.com/LSYS/forestplot/issues/47) # In[2]: df = pd.read_csv("../examples/data/regression1.csv") df # In[3]: fp.forestplot(df, # the dataframe with results data estimate='or', # col containing estimated effect size ll='low', hl='high', # columns containing conf. int. lower and higher limits varlabel='varname', # column containing variable label ylabel='Confidence interval', # y-label title xlabel='Odds Ratio', # x-label title color_alt_rows=True, figsize=(4,8), **{ 'xline' : 1., "xlinestyle": (0, (10, 5)), # long dash for x-reference line } ) # ## Capitalization of strings should be preserved # In[4]: df = pd.read_csv("../examples/data/sleep.csv") df # In[5]: fp.forestplot(df, # the dataframe with results data estimate="r", # col containing estimated effect size ll="ll", hl="hl", # columns containing conf. int. lower and higher limits varlabel="label", # column containing variable label ylabel="Confidence interval", # y-label title xlabel="Pearson correlation", # x-label title ) # ## Kwargs for p-value thresholds and symbols should be respected # In[6]: fp.forestplot(df, # the dataframe with results data estimate="r", # col containing estimated effect size ll="ll", hl="hl", # columns containing conf. int. lower and higher limits varlabel="label", # column containing variable label pval="p-val", # Column of p-value to be reported on right decimal_precision=3, symbols=("$^a$", "$^b$", "$^c$"), thresholds=(0.001, 0.01, 0.05) ) # ## CI label and P-value label should have same height fontsize # In[7]: fp.forestplot(df, # the dataframe with results data estimate="r", # col containing estimated effect size ll="ll", hl="hl", # columns containing conf. int. lower and higher limits varlabel="label", # column containing variable label pval="p-val", # Column of p-value to be reported on right ylabel="Confidence interval", # ylabel to print ) # In[ ]: