Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requesting an option to change the location of x-reference line #77

Closed
nadthoob opened this issue Jun 2, 2023 · 4 comments
Closed

Requesting an option to change the location of x-reference line #77

nadthoob opened this issue Jun 2, 2023 · 4 comments
Labels
Close in 30 days Will close in 30 days if inactive stale Type: Question

Comments

@nadthoob
Copy link

nadthoob commented Jun 2, 2023

When plotting hazard or odds ratios in forest plots it would be helpful to be able to change the location of x-reference line--to move it from x=0 to x=1.

@EythorE
Copy link

EythorE commented Jun 5, 2023

I have been passing the kwarg "xline" to fp.forestplot which is then passed to draw_ref_xline(),
similar to the customization examples in https://forestplot.readthedocs.io.

import forestplot as fp
import pandas as pd
import matplotlib.pyplot as plt

df = pd.DataFrame({'name': ['name_a', 'name_b'], 'estimate': [1.1, 1.0]})
df['Lower CI'] = df['estimate'] - 0.05
df['Upper CI'] = df['estimate'] + 0.05

fp.forestplot(df,
              estimate='estimate',
              varlabel='name',
              ll="Lower CI", hl="Upper CI", 
              figsize=(5,2)
              **{
                  "xline": 1,
                  "xlinestyle": (1, (10, 5)) # long dash for x-reference line
              }
            )
plt.show()

forest_move_x

@LSYS LSYS added Type: Question Close in 30 days Will close in 30 days if inactive labels Jun 11, 2023
@LSYS
Copy link
Owner

LSYS commented Jun 11, 2023

@nadthoob please see the above response by @EythorE

thanks @EythorE !

@github-actions
Copy link

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

@github-actions github-actions bot added the stale label Jul 11, 2023
@github-actions
Copy link

This issue was closed because it has been inactive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Close in 30 days Will close in 30 days if inactive stale Type: Question
Projects
None yet
Development

No branches or pull requests

3 participants