-
Notifications
You must be signed in to change notification settings - Fork 15
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
Issue with lineheight and line.margin #64
Comments
I'm having similar issues with lineheight, however, I am getting a "Error in unit(attr(labels, "no_rows") * attr(labels, "cex") * 1.5, "lines") : 'x' and 'units' must have length > 0", when either putting "lines" or any type of "unit(2, 'cm')" into the argument. After some debugging, it seems when calling the forestplot function, it tries to plot the legend part and is passed on and tested inside the prFpGetLayoutVP function in which it fails as none of the attributes are passed on for the legend part. Edit: Can also add that I'm running R 4.3.2 and forestplot 3.1.3. As well as doing group_by in my forestplot call. |
Sorry for not getting to this earlier, the line.margin seems to be causing issues in the fix. Could you check that the other lineheight works as expected? |
No problem. Thanks for looking into it. I re-installed the package from the CRAN, but the same problem with lineheight and line.margin remain. They do not seem to be functional and don't change the graph regardless of input. graphwidth and colgap appears to work as they should. Thanks again. |
I haven't published it yet - you need to use |
Great, thanks. That seems to fix the lineheight issue which was my main concern. Thank you! FYI I think the install should |
Thank you for this package. I'm finding it very useful.
I'm having issues with lineheight and line.margin. They do not appear to be functional and lineheight is auto regardless of my input.
Please see below example. Please let me know if I have made an obvious error!
author_year <- c("A 2023" , "B 2020" , "C 2003")
analysis <- c("unadj" , "adj" , "adj")
int_event <- c(200 , 150 , 100)
int_total <- c(400 , 400 , 300)
cont_events <- c(50 , 150 , 100)
cont_total <- c(105 , 300 , 200)
or <- c(1.5 , 1.1 , 1.3)
lowerci <- c(1.1 , 0.7 , 0.9)
upperci <- c(2.0 , 1.9 , 1.6)
df <- data.frame(author_year , analysis , int_event , int_total , cont_events , cont_total , or , lowerci , upperci)
df
df %>%
forestplot(labeltext = c(author_year , analysis , int_event , int_total , cont_events , cont_total) ,
mean = or ,
lower = lowerci ,
upper = upperci ,
xlog = TRUE ,
lineheight = unit(0.1 , "cm")) %>%
fp_add_header(author_year = c("", "Study") ,
analysis = c("", "Analysis") ,
int_event = c("Int" , "events") ,
int_total = c("" , "total") ,
cont_events = c("Cont" , "events"),
cont_total = c("", "total")) %>%
fp_set_zebra_style("#EFEFEF")
The text was updated successfully, but these errors were encountered: