Skip to content

Commit

Permalink
Merge pull request #12 from adayim/dev
Browse files Browse the repository at this point in the history
Fix minor bug in insert text
  • Loading branch information
adayim authored Aug 7, 2022
2 parents 6e400a6 + 800b45d commit b09ff5e
Show file tree
Hide file tree
Showing 10 changed files with 2,605 additions and 760 deletions.
3 changes: 3 additions & 0 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version: 0.1.6
Date: 2022-06-23 10:59:46 UTC
SHA: 9cf1e568fccb311a5878be61f7bdb46b0a75b0a9
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: forestploter
Title: Create Flexible Forest Plot
Version: 0.1.6
Version: 0.1.7
Authors@R: person(given="Alimu",
family = "Dayimu",
email = "ad938@cam.ac.uk",
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# forestploter 0.1.7

* Fixed minor issue in inserting text.
* Able to suppress legend

# forestploter 0.1.6

* Able to define the rounding digits for ticks.
Expand Down
4 changes: 2 additions & 2 deletions R/forest.R
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,9 @@ forest <- function(data,
}

# Add legend
if(group_num > 1){
if(group_num > 1 & theme$legend$position != "none"){

by_row <- if(!theme$legend$position %in% c("top", "bottom") || is.null(theme$legend$position)) TRUE else FALSE
by_row <- !theme$legend$position %in% c("top", "bottom")

legend <- theme$legend
legend$pch <- theme$ci$pch
Expand Down
2 changes: 1 addition & 1 deletion R/insert_text.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ insert_text <- function(plot,
row[i] <- row[i] - 1 # Account for padding of the plot and header

if(i != 1)
row[1] <- row[i] + i - 1 # The row number will change after adding one row
row[i] <- row[i] + i - 1 # The row number will change after adding one row

if(by_col){
# Get maximum height of text and add a row
Expand Down
4 changes: 2 additions & 2 deletions R/theme.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#' `NULL` (default), no T end will be drawn.
#' @param legend_name Title of the legend.
#' @param legend_position Position of the legend, \code{"right"}, \code{"top"},
#' \code{"bottom"}.
#' \code{"bottom"} or \code{"none"} to suppress the legend.
#' @param legend_value Legend labels (expressions). A vector should be provided
#' for the grouped forest plot. A "Group 1" etc will be created if not a vector
#' for a grouped forest plot.
Expand Down Expand Up @@ -92,7 +92,7 @@ forest_theme <- function(base_size = 12,
# legend_lwd = 0.6,
...){

legend_position <- match.arg(legend_position, c("right", "top", "bottom"))
legend_position <- match.arg(legend_position, c("right", "top", "bottom", "none"))

# Default color set
col_set <- c("#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00",
Expand Down
Binary file modified tests/testthat/Rplots.pdf
Binary file not shown.
1,521 changes: 768 additions & 753 deletions tests/testthat/_snaps/forest/edit-plot-with-theme.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b09ff5e

Please sign in to comment.