plot - Create faceted graph in R, keeping other points as greyed out -


i have data (allpca) divided site. have used qplot (pc1, pc2, data=allpca, colour=population, facets=~population) + scale_colour_manual (values=cbbpalette) facet scatterplot of 2 variables site.

example allpca:

id pc1 pc2 population syd1 0.0185 0.0426 sydney was1 0.0167 0.0415 washington rea1 0.0182 0.0431 reading aar1 0.0183 0.0427 aarhus 

this works fine, gives data each site in each of windows.

i create same plot, keeping rest of data in each facetted plot, greyed out. can help?

one way use 2 geom_point() calls. in first use data=allpca[,-4] - data without column population , set color="grey". points plotted in facets in grey. add second geom_point() data , color=population. add points in facets corresponding each population in separate colors (when facet_wrap() used).

ggplot()+   geom_point(data=allpca[,-4],aes(pc1,pc2),color="grey")+   geom_point(data=allpca,aes(pc1,pc2,color=population))+   facet_wrap(~population) 

enter image description here


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -