Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Armar theme_() propio para gráficos #2

Open
pablotis opened this issue Apr 6, 2022 · 2 comments
Open

Armar theme_() propio para gráficos #2

pablotis opened this issue Apr 6, 2022 · 2 comments
Assignees

Comments

@pablotis
Copy link
Collaborator

pablotis commented Apr 6, 2022

No description provided.

@pablotis
Copy link
Collaborator Author

pablotis commented Apr 8, 2022

#                          Armo theme                         ~~~ ----
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
theme_mex <- function(){ 
  #font <- "Georgia"   #assign font family up front
  
  theme_minimal() %+replace% 
    
    theme(
      
      # Grilla
      line = element_blank(),
      # panel.background = element_rect(fill = "transparent"),
      # plot.background = element_rect(fill = "transparent", color = "transparent"),
      # panel.border = element_rect(color = "transparent"),
      strip.background = element_rect(color = "gray20"),
      axis.text = element_blank(),
      plot.margin = margin(25, 25, 10, 25),
      panel.grid.major = element_blank(),    #strip major gridlines
      panel.grid.minor = element_blank(),    #strip minor gridlines
      axis.ticks = element_blank(),          #strip axis ticks
      
      # Texto
      plot.title.position = 'plot',
      plot.title = element_text( 
        #family = font,            
        size = 20,                
        face = 'bold',            
        hjust = 0,                # Alineamiento a la izquierda
        vjust = 2),               # Elevo un toque
      
      plot.subtitle = element_text(
        #family = font,            
        size = 14),                
      
      plot.caption.position = 'plot',
      plot.caption = element_text(
        #family = font,            
        size = 9,                 
        hjust = 1),               
      
      axis.title = element_text(  
        #family = font,            
        size = 10),    
      
      # Leyenda
      
      legend.position = 'plot'
      
      # axis.text = element_text(   
      #   #family = font,            
      #   size = 9),                
      # 
      # axis.text.x = element_text( 
      #   margin=margin(5, b = 10))
      
    )
}

@pablotis
Copy link
Collaborator Author

pablotis commented Apr 8, 2022


#                        Colores México                       ~~~ ----
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mex_colores <- function(...) {
  
  ### Lista de colores de la dnmye
  colores <- c(
    `verde`  = "#235B4E",
    `blacno` = "#FFFFFF",
    `rojo`   = "#9F2241",
    `marron` = "#BC955C",
    `gris`   = "#98989A")
  
  cols <- c(...)
  
  return(unname(colores[cols]))
  
}

@pablotis pablotis self-assigned this Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant