Bubble plot in R
0
0
Entering edit mode
2.4 years ago
Utkarsha • 0

I am trying to create a bubble plot in R but I am getting blurry outline. I need the bubbles to be solid filled and distinct boundary. my code is:

library(ggplot2)
# creating data set columns
x <- c (0,0,0,0)
y <- c(6,5,4,1)
r <- c(1586,106,452,2017)

color <- c(1,2,3,6)

cbp1 <- c("violet",  "violetred3", "violetred3", "magenta3")
sizeRange <- c(10,30)

# creating the dataframe from the above 
# columns
data <- data.frame(x, y, r, color)



ggplot(data, aes(x = x, y = y,size = r,fill = r, color=as.factor(color))) +
            ylim(-0.5,6.5) +
                #geom_point(alpha = 0.7) + scale_color_brewer(palette="Dark2") +
                 geom_point(alpha = 0.7) + scale_color_manual(values = cbp1) +
                 scale_size(range = sizeRange, name="index") +

                 theme_minimal() +
  theme(
    legend.position = "none",
    axis.text = element_blank(),
    axis.title = element_blank(),
    panel.grid = element_blank(),
    ) 
ggplot • 720 views
ADD COMMENT
1
Entering edit mode

Problem is not clear. Please post the image.

ggplot(data, aes(x = x, y = y,size = color , fill=r)) +
    geom_point(alpha = 0.7, shape = 21,colour = "black", stroke=2) +
    scale_size(range = sizeRange) +
    ylim(c(min(y)-0.5,max(y)+0.5)) +
    theme(legend.position = "none") 

enter image description here

ADD REPLY

Login before adding your answer.

Traffic: 2458 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