Skip to content

Commit b4ede86

Browse files
edit and add example using new arguments varying ref by panel
1 parent 8866681 commit b4ede86

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

R/forest_plot.R

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ label_wrap <- function(width) {
179179
#' facet_space = "free_y",
180180
#' show_table_facet_strip = "none",
181181
#' table_position = "right",
182+
#' plot_title = "",
182183
#' plot_table_ratio = 4)
183184
#'
184185
#' # Example 2
@@ -211,6 +212,7 @@ label_wrap <- function(width) {
211212
#' show_table_facet_strip = "both",
212213
#' show_table_yaxis_tick_label = TRUE,
213214
#' table_position = "below",
215+
#' plot_title = "",
214216
#' plot_table_ratio = 1)
215217
#'\dontrun{
216218
#'
@@ -256,31 +258,39 @@ label_wrap <- function(width) {
256258
#' plotdata$paramname <- c(rep("1-OH",30),rep("BZD",30))
257259
#' plotdata$paramname2 <- c(rep("AUC",15),rep("CMAX",15),rep("AUC",15),rep("CMAX",15))
258260
#'forest_plot(plotdata,
259-
#' ref_area = c(0.8, 1.2),
261+
#' show_ref_area = FALSE,
260262
#' x_facet_text_size = 13,
261263
#' y_facet_text_size = 13,
262-
#' ref_legend_text = "Reference (vertical line)\n+/- 20% limits (colored area)",
263-
#' area_legend_text = "Reference (vertical line)\n+/- 20% limits (colored area)",
264+
#' ref_legend_text = "Reference (vertical line))",
265+
#' area_legend_text = "Reference (vertical line)",
264266
#' xlabel = "Fold Change Relative to Parameter",
265267
#' facet_formula = covname~paramname2,
266268
#' facet_switch = "both",
267269
#' facet_scales = "free",
268270
#' facet_space = "free",
271+
#' legend_order = c("shape","pointinterval","ref"),
269272
#' paramname_shape = TRUE,
270-
#' interval_shape = c("square","triangle"),
273+
#' interval_shape = c("diamond","diamond filled",
274+
#' "diamond","diamond filled"),
271275
#' paramname_color = TRUE,
272276
#' combine_interval_shape_legend = TRUE,
273277
#' legend_shape_reverse = TRUE,
274278
#' legend_color_reverse = TRUE,
279+
#' interval_legend_title="Median (points)\n95% CI (horizontal lines)",
275280
#' table_position = "right", plot_title = "",
276281
#' ref_area_col = rgb( col2rgb("gray50")[1], col2rgb("gray50")[2],col2rgb("gray50")[3],
277282
#' max = 255, alpha = 0.1*255 ) ,
278-
#' interval_col = c("steelblue","red"),
283+
#' interval_col = c("steelblue","red","steelblue","red"),
279284
#' strip_col = "lightblue",
280-
#' major_x_ticks = c(0.5, 0.8,1, 1/0.8, 1/0.5),
281285
#' major_x_labels = c("1/2", "0.8","1", "1.25", "2"),
286+
#' logxscale = TRUE, major_x_ticks =c(0.5,0.8,1,1.25,2),
282287
#' table_text_size = 5,
283-
#' plot_table_ratio = 1.5)
288+
#' plot_table_ratio = 1.5,
289+
#' ref_value_by_panel = TRUE,
290+
#' ref_value_by_panel_data = as.data.frame(
291+
#' plotdata %>%
292+
#' distinct(paramname2) %>%
293+
#' mutate(xintercept=ifelse(paramname2=="CMAX",1,1.2))))
284294
#'
285295
#' # Example 3
286296
#'

man/forest_plot.Rd

Lines changed: 17 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)