i trying create bubbleplot regression line in ggplot2. when add regression line, overlays bubbleplot symbols (dollar signs) in legend solid blocks of blue color. have tried using guide=false option nothing. suggestions?
here code:
ggplot(data, aes(x=protein, y=yield, size=revenue))+ geom_point(color="darkgreen", pch=36)+ geom_smooth(method=lm, se=false, guide=false)+ scale_size_continuous(range = c(5, 15), name="revenue \n ($/acre)") 
sample data:
data <- structure(list(variety = structure(c(3l, 27l, 6l, 11l, 19l, 37l, 8l, 25l, 9l, 31l, 28l, 5l, 22l, 24l, 26l, 20l, 2l, 15l, 32l, 34l, 17l, 10l, 4l, 12l, 7l, 1l, 35l, 36l, 14l, 30l, 21l, 18l, 23l, 29l, 33l, 16l, 13l, 38l), .label = c("advance", "barlow", "bolles", "breaker", "brick", "briggs", "elgin", "faller", "focus", "forefront", "glenn", "hrs3361", "hrs3378", "hrs3419", "lcs-breakaway", "lcs-iguacu", "lcs-powerplay", "lcs albany", "linkert", "mott", "ms-chevelle", "ms-stingray", "norden", "prevail", "prosper", "rb07", "rollag", "sabin", "samson", "select", "sy-ingmar", "sy-rowyn", "traverse", "velva", "wb-digger", "wb-mayville", "wb9507", "wb9879clp" ), class = "factor"), yield = c(67l, 65l, 63l, 62l, 63l, 71l, 75l, 75l, 69l, 69l, 68l, 66l, 78l, 70l, 66l, 66l, 64l, 64l, 69l, 59l, 67l, 65l, 67l, 67l, 65l, 67l, 64l, 62l, 72l, 64l, 68l, 72l, 63l, 60l, 73l, 70l, 64l, 54l), protein = c(15.4, 15.2, 15, 15.3, 15.2, 14.7, 14.1, 14.1, 14.7, 14.7, 14.6, 14.9, 13.2, 14.3, 14.7, 14.8, 14.8, 14.9, 14.3, 14.7, 14.5, 14.8, 14.4, 14.6, 14.7, 14.4, 14.6, 14.9, 13.7, 14.7, 13.9, 13.4, 14.3, 14.7, 14.2, 13.5, 14.2, 14.6), revenue = c(488.26, 463.03, 443.34, 442.94, 437.6, 422.38, 412.77, 410.67, 409.94, 409.71, 404.03, 402.4, 401.16, 395.3, 394.27, 390.75, 390.31, 388.31, 387.65, 387.65, 387.37, 387.33, 386.94, 386.78, 385.22, 380.88, 377.94, 377.15, 372.56, 368.17, 366.36, 361.5, 356.49, 354.51, 353.18, 351.53, 350.13, 314.2)), .names = c("variety", "yield", "protein", "revenue"), class = "data.frame", row.names = c(na,-38l))
you need show_guide = false.
ggplot(data, aes(x=protein, y=yield, size=revenue))+ geom_point(color="darkgreen", pch=36)+ geom_smooth(method=lm, se=false, show_guide=false)+ scale_size_continuous(range = c(5, 15), name="revenue \n ($/acre)")
Comments
Post a Comment