Hi, im new in r studio. I want to create pie chart on one specific column in my data frame (2140 observation) that indicates the percentage of each transcript category (tx_type). I want to inform you that the type of tx_type is "character" (e.g protein_coding, processed_pseudogene, nonsense_mediated_decay ...).I tried the following code and I obtained the adjoint image https://ibb.co/TqsNTPN
p=ggplot(sk_vf1,aes(x="",fill=tx_type)) + geom_bar(width=1) +coord_polar(theta="y") + scale_fill_manual(values = colorRampPalette(brewer.pal(12, "Set3"))(nb.cols)) p + theme_void()
"sk_vf1" is the name of my data frame
I wanted to have a pie chart that indicate the occurence percentage of each transcript category (tx_type). Therefore, I tried the following code j=paste(prop.table(table(sk_vf1$tx_type))*100, "%", sep = "") p=ggplot(sk_vf1,aes(x="",fill=tx_type)) + geom_bar(width=1) +coord_polar(theta="y") + geom_label(aes(label =j)) p + scale_fill_manual(values = colorRampPalette(brewer.pal(12, "Set3"))(nb.cols))
Unfortunately, I get the following error: Aesthetics must be either length 1 or the same as the data (2140): label
Thanks in advance, any little help will be appreciated :-)
Thanks for your reply, I already performed the pie chart (check the link below), I want to add the percentage
note: Please prefer other quantitative visualizations for scientific data.
Thanks a lot, it works :-)