R/impact_style.R

Defines functions theme_impact theme_boxplot_horizontal theme_boxplot_vertical theme_bar theme_labels_horizontal theme_labels_vertical theme_numbers

Documented in theme_impact

#' IMPACT ggplot theme
#' @details works like ?theme_minimal
#' @return
#' @examples
theme_impact <- function(){
  family_font <- windowsFonts(Times=windowsFont("Arial Narrow"))
  style <- theme(text=element_text(family=family_font$Times, colour='black'), axis.text.x = element_text(angle=30))
  style <- style + ggthemes::theme_tufte() + theme(plot.title = element_text(family = family_font$Times,
                                                   colour = reach_style_color_darkgrey(),
                                                   size = 18,
                                                   face = 'bold',
                                                   hjust = 0.5  ))


  return(style)
}

theme_boxplot_horizontal <- function(){
  family_font <- windowsFonts(Times=windowsFont("Arial Narrow"))
  style <- theme(axis.ticks.y = element_blank(),
                 axis.ticks.x = element_blank(),
                 text =element_text(family=family_font$Times),
                axis.text.x = element_text(size  = 10, angle = 0,
                             hjust = 0.5,
                             vjust = 0.5,
                             colour = "black",
                             family = family_font$Times),
                axis.text.y = element_text(size  = 10,
                                           hjust = 1.0,
                                           vjust = 0.5,
                                           colour = "black",
                                           family = family_font$Times)
                 )

  return(style)
}

theme_boxplot_vertical <- function(){
  family_font <- windowsFonts(Times=windowsFont("Arial Narrow"))
  style <- theme(axis.ticks.y = element_blank(),
                 axis.ticks.x = element_blank(),
                 text =element_text(family=family_font$Times),
                 axis.text.x = element_text(size  = 10, angle = 90,
                                            hjust = 0.5,
                                            vjust = 0.5,
                                            colour = "black",
                                            family = family_font$Times),

  )

  return(style)
}
theme_bar <- function(){

  style <- theme_tufte()+ theme(axis.title.x=element_blank(),
                                axis.text.x=element_blank(),
                                axis.ticks.x=element_blank(),
                                axis.title.y=element_blank(),
                                axis.text.y=element_blank(),
                                axis.ticks.y=element_blank(),
                                axis.ticks.length = unit(0, "mm")) + theme(plot.margin = unit(c(0,0,0,0), "cm"))


  return(style)

}



theme_labels_horizontal <- function(fonsize){
  family_font <- windowsFonts(Times=windowsFont("Arial Narrow"))

  style <- theme_tufte() + theme(axis.text.x = element_blank(),
                                axis.ticks.x = element_blank(),
                                axis.title.x = element_blank(),
                                text =element_text(family=family_font$Times)) +
                            theme(axis.title.y=element_blank(),
                                  axis.ticks.y=element_blank(),
                                  text =element_text(family=family_font$Times)) +
                            theme(text=element_text(family=family_font$Times)) +
                            theme(axis.text.y = element_text(size  = fonsize, angle = 0,
                                    hjust = 0,
                                    vjust = 0.5,
                                    colour = "black",
                                    family = family_font$Times),
                                    axis.ticks.length = unit(0, "mm"))+
                            theme(plot.margin = unit(c(0,0,0,0), "cm"))

  return(style)

}


theme_labels_vertical <- function(fonsize, angle){
  family_font <- windowsFonts(Times=windowsFont("Arial Narrow"))

  style <- theme_tufte() + theme(axis.text.y = element_blank(),
                                 axis.ticks.y = element_blank(),
                                 axis.title.y = element_blank(),
                                 text =element_text(family=family_font$Times)) +
    theme(axis.title.x=element_blank(),
          axis.ticks.x=element_blank(),
          text =element_text(family=family_font$Times)) +
    theme(text=element_text(family=family_font$Times)) +
    theme(axis.text.x = element_text(size  = fonsize, angle = angle,
                                     hjust = 0.5,
                                     vjust = 1.0,
                                     colour = "black",
                                     family = family_font$Times),
          axis.ticks.length = unit(0, "mm"))+
    theme(plot.margin = unit(c(0,0,0,0), "cm"))

  return(style)

}


theme_numbers <- function(){
  family_font <- windowsFonts(Times=windowsFont("Arial Narrow"))

  style <- theme_tufte() + theme(axis.title.x=element_blank(),
                                axis.text.x=element_blank(),
                                axis.ticks.x=element_blank(),
                                axis.title.y=element_blank(),
                                axis.text.y=element_blank(),
                                axis.ticks.y=element_blank(),
                                axis.ticks.length = unit(0, "mm")) +
                            theme(text=element_text(family=family_font$Times)) +
                            theme(plot.margin = unit(c(0,0,0,0), "cm"))
  return(style)
}
sharonorengo/visualisationIMPACT documentation built on Aug. 12, 2019, 3:34 p.m.