You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: mforestplots do not correspond to (correct) forestplots
Background: I have data for unadjusted and adjusted odds ratios with confidence intervals.
I plot the same data using both forestplot (with repeated variable lables) and mforestplot.
With forestplot, the symbols have the correct ORs and CIs, although order of the variable labels is not consistent within groups.
However with mforestplot, the symbols do not consistently align with the correct labels.
For example:
Symbols in Age and Comorbidity groups no longer match the correct label values in forestplot (e.g., Age4 ORs should both be < 1, Obesity ORs should both be > 1) .
Sex, Race, Rank, and Status groups correctly match.
The code is the same except fp.mforestplot is used in place of fp.forestplot.
Questions:
Is there a way to fix the mforestplot misalignment?
In forestplot, is there a way to have the repeated variable labels sorted within the groups?
Thanks in advance for any guidance.
title = 'SGLT2i Odds Ratios'
est = 'SGLT2i-OR'
low = 'SGLT2i-OR-LL'
hi = 'SGLT2i-OR-UL'
varlabel = 'Label'
ylabel = '95% CI'
xlabel = 'Odds Ratio (Ref: Age=18-30, Race=White, Sex=Female, Rank=ES)'
groupvar = 'Group'
grouporder = ['Age', 'Sex', 'Race', 'Rank', 'Status', 'Comorbidity' ]
rightannote = ['pval-SGLT2i']
right_ah = ['p']
xticks = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
modellabels = ['Unadjusted', 'Adjusted']
model = 'model'
figsize = (8, 20)
xfp = fp.forestplot(xdf, # the dataframe with results data
estimate=est, # col containing estimated effect size
ll=low, hl=hi, # columns containing CI low and high limits
varlabel=varlabel, # column containing variable label
model_col=model,
ylabel=ylabel, # y-label title
xlabel=xlabel, # x-label title
blipblop=True,
title=title,
groupvar=groupvar,
group_order=grouporder,
color_alt_rows=True,
# rightannote=rightannote,
# right_annoteheaders=right_ah,
modellables=modellabels,
xticks=xticks,
table=True,
figsize=figsize,
# Additional kwargs for customizations
**{
"markersize": 30,
# override default vertical offset between models (0.0 to 1.0)
"offset": 0.35,
`"xline": 1,
"xlinestyle": (0, (10, 5)), # long dash for x-reference line
"xlinecolor": ".8", # gray color for x-reference line
},
)
FORESTPLOT
MFORESTPLOT
(UPDATE: corrected minor typo in code)
The text was updated successfully, but these errors were encountered:
+1 for this. It looks like when the grouping is done to plot the point estimates and CIs, that new row ordering is not tracked and the labels are placed in the order they are in the dataframe?:
Issue: mforestplots do not correspond to (correct) forestplots
Background: I have data for unadjusted and adjusted odds ratios with confidence intervals.
I plot the same data using both forestplot (with repeated variable lables) and mforestplot.
With forestplot, the symbols have the correct ORs and CIs, although order of the variable labels is not consistent within groups.
However with mforestplot, the symbols do not consistently align with the correct labels.
For example:
Symbols in Age and Comorbidity groups no longer match the correct label values in forestplot (e.g., Age4 ORs should both be < 1, Obesity ORs should both be > 1) .
Sex, Race, Rank, and Status groups correctly match.
The code is the same except fp.mforestplot is used in place of fp.forestplot.
Questions:
Thanks in advance for any guidance.
FORESTPLOT
MFORESTPLOT
(UPDATE: corrected minor typo in code)
The text was updated successfully, but these errors were encountered: