Home > Software engineering >  What graph type in R can be used to show rankings by filling in circles
What graph type in R can be used to show rankings by filling in circles

Time:02-24

I am trying to make an 'infographic' resume and I would like to use R. I have created a gant chart and now want to rank my skills. I can't figure out what type of chart with produce circles that are filled according to a numerical ranking. Here is an example of what I want. And below that is example data. Any help appreciated Thanks

enter image description here

 dput(datAnal_skills)
structure(list(Type = c("Programming", "Programming", "Programming", 
"Programming", "Analytics", "Analytics", "Analytics", "Analytics", 
"Personal", "Personal", "Personal", "Personal"), Skill = c("R", 
"Perl", "Python", "SQL", "Visualization", "Statistics", "Databases", 
"Research Design", "Problem-solver", "Motivated", "Team player", 
"Multi-tasker"), Of.5 = c(4.7, 4.5, 4, 4, 4.7, 4.5, 4.5, 4.5, 
4.5, 4.5, 4.5, 4.5), Of.10 = c(9L, 8L, 8L, 8L, 9L, 9L, 8L, 8L, 
9L, 9L, 8L, 8L)), class = "data.frame", row.names = c(NA, -12L
))

CodePudding user response:

You can first create a grid of points, then colour the point based on whether grid position is lower than the score. Example below is for the 10-point scale, as the 5 point scale aren't integers and don't translate to bullets very well.

library(ggplot2)

# df <- structure(...) # omitted for brevity

# For every skill, place 10 bullets
grid <- expand.grid(skill_id = seq_along(df$Skill), bullets = 1:10)

# Match skill name and score from original data
grid$score <- df$Of.10[grid$skill_id]
grid$skill <- df$Skill[grid$skill_id]

ggplot(grid, aes(factor(bullets), skill))  
  geom_point(aes(colour = bullets <= score), size = 3)  
  scale_colour_manual(values = c("grey70", "grey30"),
                      guide = "none")

CodePudding user response:

Something like this:

library(ggplot)

ggplot(df, aes(x=Skill, y=Type)) 
  geom_point(aes(size=Of.10)) 
  coord_flip()

enter image description here

CodePudding user response:

Great Ideas. Here is what I came up with.

    datAnal_skills$Type<-factor(datAnal_skills$Type,levels=c("Programming","Analytics","Personal"))
#
ggplot(datAnal_skills, aes(x = Of.10, y = reorder(Skill,Of.10)))  
  geom_point(size = 3)    # Use a larger dot
  facet_wrap(~Type,scales = "free_y") 
  xlim(c(0,10)) 
  ylab("") 
  xlab("") 
  theme_bw()  
  theme(
    axis.text.x=element_blank(),
    panel.grid.major.x = element_blank(),
    panel.grid.minor.x = element_blank(),
    panel.grid.major.y = element_line(colour = "grey60", linetype = "dashed")
  )

enter image description here

  • Related