How does one distinguish 4 different factors (not using size)? Is it possible to use hollow and solid points to distinguish a variable in ggplot2?
test=data.frame(x=runif(12,0,1),
y=runif(12,0,1),
siteloc=as.factor(c('a','b','a','b','a','b','a','b','a','b','a','b')),
modeltype=as.factor(c('q','r','s','q','r','s','q','r','s','q','r','s')),
mth=c('Mar','Apr','May','Mar','Apr','May','Mar','Apr','May','Mar','Apr','May'),
yr=c(2010,2011,2010,2011,2010,2011,2010,2011,2010,2011,2010,2011))
where x are observations and y are modeling results and I want to compare different model versions across several factors. Thanks!
I think , it very difficult visually to distinguish/compare x and y values according to 4 factors. I would use faceting and I reduce the number of factors using interaction
for example.
Here an example using geom_bar
:
set.seed(10)
library(reshape2)
test.m <- melt(test,measure.vars=c('x','y'))
ggplot(test.m)+
geom_bar(aes(x=interaction(yr,mth),y=value,
fill=variable),stat='identity',position='dodge')+
facet_grid(modeltype~siteloc)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With