Categorical bubble plot for mapping studies

后端 未结 3 1725
有刺的猬
有刺的猬 2020-12-08 21:41

How to create a categorical bubble plot, using GNU R, similar to that used in systematic mapping studies (see below)?

3条回答
  •  再見小時候
    2020-12-08 22:37

    Here a version using levelplot from latticeExtra.

    library(latticeExtra)
    levelplot(count~Var1*Var2,data=dat,
              panel=function(x,y,z,...)
              {
                panel.abline(h=x,v=y,lty=2)
                cex <- scale(z)*3
                panel.levelplot.points(x,y,z,...,cex=5)
                panel.text(x,y,label=z,cex=0.8)
              },scales=(x=list(abbreviate=TRUE))) ## to get short labels
    

    enter image description here

    To get the size of bubble proprtional to the count , you can do this

    library(latticeExtra)
    levelplot(count~Var1*Var2,data=dat,
              panel=function(x,y,z,...)
              {
                panel.abline(h=x,v=y,lty=2)
                cex <- scale(z)*3
                panel.levelplot.points(x,y,z,...,cex=5)
                panel.text(x,y,label=z,cex=0.8)
    
              })
    

    I don't display it since the render is not clear as in the fix size case.

提交回复
热议问题