I want to create a bubble chart like this:
I want the y axis for project stage, and x axis for nothing. The size of the circle could be the number of projects and the color can be the status.
I think it should be a bubble chart of point chart, so I add solid value for x axis to set x position for all circle. But I don't have an idea how to set y axis for them.
This is my data sample:
test<- data.frame(
stage = c("Designment","Designment","Development","Development","Development","Go Live","Go Live","Requirement","Requirement","Test","Test","UAT","UAT"),
status=c("At Risk","On Track","At Risk","On Hold","On Track","Completed","On Track","On Hold","On Track","Completed","On Track","Completed","On Track"),
total=c("1","9","1","2","23","25","2","9","11","1","6","1","1"),
x=c("1.00114754443462","1.01564186197464","0.998163923987934","1.00428226961525","1.00490918326707","0.996299554522548","0.979025253250673","0.996035528009065","0.997494036022247","0.998396639432905","0.987719363426524","0.990205701650603","1.01609094768587"),
y=c("0.444705037188138","0.628219900896655","0.538614704467962","0.587639745611629","0.289049383370184","0.568458079545019","0.302063527274047","0.520840349575939","0.687424167003373","0.564338710368995","0.593610161950449","0.662218219412209","0.370813953512016")
)
Is there any solution to this kind of chart?
CodePudding user response:
Using ggplot2
you can:
library(palmerpenguins)
library(tidyverse)
penguins %>%
group_by(species, sex) %>%
summarise(
body_mass_g = mean(body_mass_g),
n = n(),
.groups = "drop"
) %>%
drop_na() %>%
ggplot(aes(x = body_mass_g, y = species, colour = sex, size = n))
geom_point(alpha = 0.5)
geom_text(aes(label = n), size = 3, colour = "white")
scale_size(range = c(15, 30), guide = NULL)
Created on 2022-08-15 by the reprex package (v2.0.1)
CodePudding user response:
There are a few different ways to create a bubble chart in R. One way is to use the "ggplot2" package. Another way is to use the "plotly" package.