Skip to content

Commit

Permalink
New argument font.family in ggscatter
Browse files Browse the repository at this point in the history
  • Loading branch information
kassambara committed Apr 13, 2017
1 parent f0ec8d2 commit 9cccb0c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- Now the default legend position is `right`.
- New argument `show.legend.text` in the `ggscatter()` function. Use show.legend.text = FALSE to hide text in the legend.
- New arguments `title, submain, subtitle, caption, font.submain, font.subtitle, font.caption` in the `ggpar()` function.
- New argument `font.family` in `ggscatter()`.

## Bug fixed

Expand Down
2 changes: 1 addition & 1 deletion R/geom_exec.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ geom_exec <- function (geomfunc = NULL, data = NULL,
# error
"ymin", "ymax", "xmin", "xmax",
# text
"label", "hjust", "vjust", "fontface", "angle",
"label", "hjust", "vjust", "fontface", "angle", "family",
# smooth
"se", "level", "fullrange",
"conf.int.level",
Expand Down
7 changes: 4 additions & 3 deletions R/ggscatter.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ NULL
#' the color (e.g.: "red") of point labels. For example \emph{font.label =
#' c(14, "bold", "red")}. To specify only the size and the style, use
#' font.label = c(14, "plain").
#' @param font.family character vector specifying font family.
#' @param label.select character vector specifying some labels to show.
#' @param repel a logical value, whether to use ggrepel to avoid overplotting
#' text labels or not.
Expand Down Expand Up @@ -130,7 +131,7 @@ ggscatter <- function(data, x, y,
ellipse.type = "norm", ellipse.alpha = 0.1,
mean.point = FALSE, mean.point.size = ifelse(is.numeric(size), 2*size, size),
star.plot = FALSE, star.plot.lty = 1, star.plot.lwd = NULL,
label = NULL, font.label = c(12, "plain"),
label = NULL, font.label = c(12, "plain"), font.family = "",
label.select = NULL, repel = FALSE, label.rectangle = FALSE,
cor.coef = FALSE, cor.method = "pearson", cor.coef.coord = c(NULL, NULL), cor.coef.size = 12,
ggp = NULL, show.legend.text = NA,
Expand Down Expand Up @@ -256,7 +257,7 @@ ggscatter <- function(data, x, y,
p <- p + .geom_exec(ggfunc, data = lab_data, x = x, y = y,
label = label, fontface = font.label$face,
size = font.label$size/3, color = font.label$color,
alpha = alpha,
alpha = alpha, family = font.family,
box.padding = unit(0.35, "lines"),
point.padding = unit(0.3, "lines"),
force = 1, show.legend = show.legend.text)
Expand All @@ -269,7 +270,7 @@ ggscatter <- function(data, x, y,
vjust <- -0.4
}
p <- p + .geom_exec(ggfunc, data = lab_data, x = x, y = y, color = color,
label = label, fontface = font.label$face,
label = label, fontface = font.label$face, family = font.family,
size = font.label$size/3, color = font.label$color,
vjust = vjust, alpha = alpha, show.legend = show.legend.text)
}
Expand Down
10 changes: 6 additions & 4 deletions man/ggscatter.Rd

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

0 comments on commit 9cccb0c

Please sign in to comment.