i have data
set.seed(28100) my_data <- data.frame(cat = factor(sample(c('cat1','cat2'), 50, replace = t)), x = sample(1:100, 50, replace = t), y = sample(1:100, 50, replace = t), value = sample(1:100), 50, replace = t)
and want color observations based on 2 dimensions. first, want distinguish between categories colouring based on factor variable cat
. second, want scale colour based on continuous variable value
.
this doesn't give expected result:
require(ggplot2) ggplot(my_data, aes(x=x, y=y, colour=cat, fill=value)) + geom_point(size=5) + theme_bw()
is possible tweaking arguments of ggplot()
or geom_point()
?
Comments
Post a Comment