LSYS / forestplot

A Python package to make publication-ready but customizable coefficient plots.
http://forestplot.rtfd.io
MIT License
112 stars 10 forks source link

Adding lines in X axis #63

Closed ksarathbabu closed 1 year ago

ksarathbabu commented 1 year ago

Is there a way to move the xaxis line from 0 to 1 or add a new line in Xaxis?

LSYS commented 1 year ago

@ksarathbabu, use the xline option to place the x-axis line where you want:

import forestplot as fp

df = fp.load_data("sleep")

ax = 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
              xline=.15,  # <---- Add this line here
              )

image

If you want to add even more lines, check out the axvline from matplotlib. You can assign the axes object from fp.forestplot (like above) and then do a ax.axvline(-.15). See the link to the axvline docs for more parameters to tweak.

ksarathbabu commented 1 year ago

Thank you , That worked well. One additional question, One the columns in the table is automatically changed to having two decimal points even though its an integer number. How do I keep it to integer?

LSYS commented 1 year ago

can you show an example of what you mean?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive.