Home > OS >  How to draw the circle with certain radius around the point in the plot?
How to draw the circle with certain radius around the point in the plot?

Time:02-16

I'd like to draw the bubble plot with additional central point.
X1, Y1 is the x-axis and y-axis, respectively, and N1 is the radius of the circle around the point.

require(ggplot2)
df <- structure(list(X1 = c(1:10), 
                     Y1 = c(15:24), 
                     N1 = c(5, 2, 3, 5, 1, 2, 6, 3, 4, 1)), 
                class = "data.frame", row.names = c(NA, -10L))
df
   X1 Y1 N1
1   1 15  5
2   2 16  2
3   3 17  3
4   4 18  5
5   5 19  1
6   6 20  2
7   7 21  6
8   8 22  3
9   9 23  4
10 10 24  1

Simply, I thought that it will be okay to overlap the bubble plot and basic plot.

ggplot(df, aes(x=X1, y=Y1, size=N1)) 
  theme_bw() 
  geom_point(alpha=0.3, color='blue') 
  scale_size(range=c(10,40)) 
  theme(legend.position="none")

enter image description here

But there were two problems.

  1. How can I eliminate the line around the circles?
  2. How can I add the center point on the bubble plot?

The below figure is the expected result. enter image description here

I tried to mimic the code in this site: enter image description here

  • Related