Skip to content

Commit

Permalink
Further customization is now accepted when theme is specified #283
Browse files Browse the repository at this point in the history
  • Loading branch information
kassambara committed Jun 6, 2020
1 parent 1edc524 commit 098e949
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

## Bug fixes

- `ggtextable()` now supports further customization when theme is specified (#283).
- the argument `font.family` is now correctly handled by `ggscatter()` (#149)
- `ggpar()` arguments are correctly applied using `ggpie()` (#277).
- `ggscatter()`: When `conf.int = FALSE`, fill color is set to "lightgray" for the regression line confidence band ([@zhan6073, #111](https://github.com/kassambara/ggpubr/issues/111)).
Expand Down
13 changes: 7 additions & 6 deletions R/ggtexttable.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ NULL
#' # Blank theme
#' ggtexttable(df, rows = NULL, theme = ttheme("blank"))
#'
#' # light theme
#' ggtexttable(df, rows = NULL, theme = ttheme("light"))
#'
#' # classic theme
#' ggtexttable(df, rows = NULL, theme = ttheme("classic"))
#'
Expand Down Expand Up @@ -161,21 +164,19 @@ ttheme <- function(base_style = "default", base_size = 11, base_colour = "black"
{

style <- tstyle(base_style, size = base_size)

if(!is.null(style)){
colnames.style <- style$colnames.style
rownames.style <- style$rownames.style
tbody.style <- style$tbody.style
if(missing(colnames.style)) colnames.style <- style$colnames.style
if(missing(rownames.style)) rownames.style <- style$rownames.style
if(missing(tbody.style)) tbody.style <- style$tbody.style
}


.ttheme <- gridExtra::ttheme_default(base_size = base_size,
base_colour = base_colour,
padding = padding)

.ttheme$colhead <- do.call(.add_item, c(list(.list = .ttheme$colhead), colnames.style))
.ttheme$rowhead <- do.call(.add_item, c(list(.list = .ttheme$rowhead), rownames.style))
.ttheme$core <- do.call(.add_item, c(list(.list = .ttheme$core), tbody.style))

attr(.ttheme, "style") <- base_style

.ttheme
Expand Down
3 changes: 3 additions & 0 deletions man/ggtexttable.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 098e949

Please sign in to comment.