Skip to content

Commit

Permalink
fix for #31
Browse files Browse the repository at this point in the history
  • Loading branch information
kassambara committed May 23, 2017
1 parent d678847 commit c042173
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion R/fviz.R
Expand Up @@ -255,7 +255,7 @@ fviz <- function(X, element, axes = c(1, 2), geom = "auto",
if(!is.null(esup)) p <- .add_supp (p, X, element = esup$name, axes = axes, select = select,
geom = geom, color = esup$color, shape = esup$shape, pointsize = pointsize,
labelsize = labelsize, addlabel = esup$addlabel, repel = repel, linetype = 2,
scale. = scale., ca_map = ca_map)
scale. = scale., ca_map = ca_map, ...)


p <- .fviz_finish(p, X, axes, axes.linetype, ...) +
Expand Down
8 changes: 5 additions & 3 deletions R/fviz_add.R
Expand Up @@ -16,6 +16,7 @@
#' @param linetype the linetype to be used when geom ="arrow"
#' @param repel a boolean, whether to use ggrepel to avoid overplotting text
#' labels or not.
#' @param font.family character vector specifying font family.
#' @param ... Additional arguments, not used
#' @return a ggplot2 plot
#' @author Alboukadel Kassambara \email{alboukadel.kassambara@@gmail.com}
Expand All @@ -41,7 +42,7 @@
#' @export
fviz_add <- function(ggp, df, axes = c(1,2), geom=c("point", "arrow"), color ="blue",
addlabel = TRUE, labelsize = 4, pointsize = 2, shape=19, linetype ="dashed",
repel = FALSE, ...)
repel = FALSE, font.family = "", ...)
{
# Deprecated arguments
extra_args <- list(...)
Expand Down Expand Up @@ -89,12 +90,13 @@ fviz_add <- function(ggp, df, axes = c(1,2), geom=c("point", "arrow"), color ="b
if(addlabel | "text" %in% geom){
if(repel){
p <- p + ggpubr::geom_exec(ggrepel::geom_text_repel, data = df, x = "x", y = "y",
label = "name", color = color, size = labelsize)
label = "name", color = color, size = labelsize,
family = font.family)
}
else{
p <- p + ggpubr::geom_exec(geom_text, data = df, x = "x", y = "y",
label = "name", color = color, size = labelsize,
vjust=vjust, hjust = hjust)
vjust=vjust, hjust = hjust, family = font.family)

# p <- p + geom_text(data = df, aes_string("x", "y"), color = color,
# label = df$name, size = labelsize, vjust=vjust, hjust = hjust)
Expand Down
4 changes: 3 additions & 1 deletion man/fviz_add.Rd

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

0 comments on commit c042173

Please sign in to comment.