how can I draw a connecting line between the label and the plot in R
0
0
Entering edit mode
2.9 years ago

Hello everyone, This is my script for the plot,

> library(reader)

> data <- read.csv("C:\\Users\\user\\Documents\\kingdom.csv", header=TRUE, stringsAsFact=FALSE)
> dfdata = data.frame(data)

> dfdata

   Kingdom  Total

1 Bacteria 273523

2  Archaea   2613


> sizeRange <- c(0,30)

> library(ggplot2)
![enter image description here][1]
> ggplot(data, aes(x=0,y=Kingdom,color=Kingdom)) + geom_point(aes(size = Total,alpha=10),colour="blue",stroke=2) + scale_size(range = sizeRange)+ theme_bw() + theme(panel.border = element_blank(), panel.grid.major = element_blank(),panel.grid.minor = element_blank(), axis.line = element_line(colour = "white"))

somebody, please tell me how can I get a connecting line between my y-axis label and the plot

I want something like this

enter image description here

bubble ggplot2 R • 653 views
ADD COMMENT
0
Entering edit mode
ggplot(df, aes(x=0,y=Kingdom,color=Kingdom, label=Kingdom)) +
    geom_text_repel(nudge_x=-0.05, size=12, show.legend = F) +
    geom_point(aes(size = Total,alpha=10),colour="blue",stroke=2) +
    scale_size(range = sizeRange)+ 
    theme_bw() + 
    theme(panel.border = element_blank(), 
          panel.grid.major = element_blank(),
          panel.grid.minor = element_blank(), 
          axis.line = element_line(colour = "white"),
          axis.text=element_blank(),
          axis.ticks=element_blank(),
          axis.title.x = element_blank())
ADD REPLY

Login before adding your answer.

Traffic: 2226 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6