r - Categorical bubble plot for mapping studies -


how create categorical bubble plot, using gnu r, similar used in systematic mapping studies (see below)?

categorical bubble plot used in mapping studies

edit: ok, here's i've tried far. first, dataset (var1 goes x-axis, var2 goes y-axis):

> grid                          var1                      var2 count 1              does.not.apply            does.not.apply    53 2               not.specified            does.not.apply    15 3   active.learning..general.            does.not.apply     1 4      problem.based.learning            does.not.apply     2 5              project.method            does.not.apply     4 6         case.based.learning            does.not.apply    22 7               peer.learning            does.not.apply     6 10                      other            does.not.apply     1 11             does.not.apply             not.specified    15 12              not.specified             not.specified    15 21             does.not.apply active.learning..general.     1 23  active.learning..general. active.learning..general.     1 31             does.not.apply    problem.based.learning     2 34     problem.based.learning    problem.based.learning     2 41             does.not.apply            project.method     4 45             project.method            project.method     4 51             does.not.apply       case.based.learning    22 56        case.based.learning       case.based.learning    22 61             does.not.apply             peer.learning     6 67              peer.learning             peer.learning     6 91             does.not.apply                     other     1 100                     other                     other     1 

then, trying plot data:

# based on http://flowingdata.com/2010/11/23/how-to-make-bubble-charts/ grid <- subset(grid, count > 0) radius <- sqrt( grid$count / pi ) symbols(grid$var1, grid$var2, radius, inches=0.30, xlab="research type", ylab="research area") text(grid$var1, grid$var2, grid$count, cex=0.5) 

here's result: what i've got

problems: axis labels wrong, dashed grid lines missing.

here ggplot2 solution. first, added radius new variable data frame.

grid$radius <- sqrt( grid$count / pi ) 

you should play around size of points , text labels inside plot perfect fit.

library(ggplot2) ggplot(grid,aes(var1,var2))+   geom_point(aes(size=radius*7.5),shape=21,fill="white")+   geom_text(aes(label=count),size=4)+   scale_size_identity()+   theme(panel.grid.major=element_line(linetype=2,color="black"),         axis.text.x=element_text(angle=90,hjust=1,vjust=0)) 

enter image description here


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -