#6 Añadir función geom_legend

Closed
opened 2 years ago by marcelcosta · 1 comments
Owner

Aquí está la función ya hecha!

function to print in the middle

geom_legend<-function(data, x, y, var, stat="median", color="black", ...){
  data<-data %>% group_by({{var}}) %>% summarise("{{x}}":=median({{x}}), "{{y}}":=median({{y}}))
  if (!is.null(color)){
    return(geom_label(data = data, aes({{x}},{{y}}, label={{var}}), color=color, ...))
  }else{
    return(geom_label(data = data, aes({{x}},{{y}}, label={{var}}),...))
    }
}
Aquí está la función ya hecha! #### function to print in the middle ```r geom_legend<-function(data, x, y, var, stat="median", color="black", ...){ data<-data %>% group_by({{var}}) %>% summarise("{{x}}":=median({{x}}), "{{y}}":=median({{y}})) if (!is.null(color)){ return(geom_label(data = data, aes({{x}},{{y}}, label={{var}}), color=color, ...)) }else{ return(geom_label(data = data, aes({{x}},{{y}}, label={{var}}),...)) } } ```
marcelcosta added the
Nueva
label 2 years ago
Poster
Owner

Hecha, aunque ahora se llama gglegend.

Hecha, aunque ahora se llama gglegend.
marcelcosta closed this issue 2 years ago
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.