Reputation: 3441
With these data
Data <- structure(list(ObsVal = c(22L, 50L, 8L, 15L, 54L, 30L, 11L, 90L,
6L, 53L, 9L, 42L, 72L, 40L, 60L, 58L, 1L, 20L, 37L, 2L, 50L,
68L, 20L, 19L, 58L, 5L), Porp = c(0.0909090909090909, 0.02, 0,
0, 0, 0, 0.272727272727273, 0.455555555555556, 0, 0.452830188679245,
0.111111111111111, 0.404761904761905, 0, 0.025, 0.0166666666666667,
0.120689655172414, 0, 0.1, 0.108108108108108, 0, 0, 0.0294117647058824,
0, 0, 0.310344827586207, 0), Pred = c(26, 52, 6, 15, 39, 30,
13, 85, 8, 62, 5, 48, 92, 52, 71, 68, 1, 28, 47, 1, 41, 106,
29, 19, 39, 7)), .Names = c("ObsVal", "Porp", "Pred"), class = "data.frame", row.names = c(NA,
-26L))
and this code
require(ggplot2)
p <- ggplot(Data, aes(x=ObsVal, y=Pred, size=Porp))+
geom_point()+
geom_smooth(method=lm, color="red")+
theme_bw()+
guides(size=FALSE)
p
I can make this plot
but the dots are too small. When I increase the size with the code
p+scale_size_area(max_size=10)
The dots get larger, but I loose the values where Porp is zero.
I tried to add 1 to all Porp values, but then the sizes were all the same.
It is possible to increase the size of the dots as in the 2nd fig, but also include points were Porp is zero?
Upvotes: 1
Views: 979
Reputation: 67828
You may try to use scale_size_continuous
and its range
argument. E.g. something like this:
p + scale_size_continuous(range = c(2, 10))
Upvotes: 2