forestplot icon indicating copy to clipboard operation
forestplot copied to clipboard

Request: Option to move ci_report to right of figure

Open jdoiii opened this issue 1 year ago • 2 comments

This is kind of a picky request, but could there be an option to move the confidence interval report to the right of the forest plot, similar to the figure below? I suppose this can be done manually by setting ci_report=False and then recreating it as a separate column typed in by hand. But that would get pretty tedious.

Thanks again for an extremely nice program!

image

jdoiii avatar Jul 20 '24 15:07 jdoiii

@jdoiii Try something like this:

import forestplot as fp

df = fp.load_data("sleep")  # companion example data
df.head(3)

fp.forestplot(
    df,
    estimate="r",
    ll="ll", hl="hl",
    varlabel="label",
    ci_report=False,  # Turn off conf. int. reporting
    rightannote=["est_ci"],  # Add conf. int. reporting on the right
    right_annoteheaders=["Est. (95% CI)"],  # Column header
)

image

LSYS avatar Jul 22 '24 01:07 LSYS

@LSYS Thanks for the response.

That works for the sleep dataset, but not mine. The issue appears to be rightannote=["est_ci"] . When I run it on my df I get (not surprisingly): AssertionError: the field ['est_ci'] is not found in dataframe.

I could create a column "est_ci" with the entire text, but I don't understand why the example sleep df works without an "est_ci" column.

Also I notice the sleep df has a column "CI95%". Is that necessary? It seems sort of redundant if you have both hl and ll columns. Is that necessary? I did create it before running my df just in case it was.

EDIT: Please ignore above. I found the information on processed columns at https://pypi.org/project/forestplot/

jdoiii avatar Jul 29 '24 18:07 jdoiii

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

github-actions[bot] avatar Aug 30 '24 01:08 github-actions[bot]

This issue was closed because it has been inactive.

github-actions[bot] avatar Sep 01 '24 02:09 github-actions[bot]