#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import forestplot as fp print(fp.__version__) # ## Table headers don't work as expected with 6 (or fewer) rows of data # See issue [#52](https://github.com/LSYS/forestplot/issues/52) # In[2]: df = fp.load_data("sleep") df.head(3) # In[3]: std_opts = dict( estimate="r", ll="ll", hl="hl", varlabel="label", capitalize="capitalize", pval="p-val", # column containing p-values to be formatted annote=["n", "power", "est_ci"], # columns to report on left of plot annoteheaders=["N", "Power", "Est. (95% Conf. Int.)"], # ^corresponding headers rightannote=["formatted_pval", "group"], # columns to report on right of plot right_annoteheaders=["P-value", "Variable group"], # ^corresponding headers xlabel="Pearson correlation coefficient", # x-label title table=True ) # In[4]: # 6 rows and below: Right annotation disappears fp.forestplot(df.head(6), **std_opts) # In[5]: # 7 rows and above: Things work as expected fp.forestplot(df.head(7), **std_opts) # In[ ]: