
  # -------------------------------------------------------------------------------------------------------------------------  #
  #  -----------------------------------------------------------------------------------------------------------------------   #
  #                                                                                                                            #
  #           File Name              :  ggBubblePlot.R                                                                         #
  #           Last Updated Funclist  :  19 Feb 2015,  1:05 PM (Thursday)                                                       #
  #                                                                                                                            #
  #           Author Name            :  Rick Saporta                                                                           #
  #           Author Email           :  RickSaporta@gmail.com                                                                  #
  #           Author URL             :  www.github.com/rsaporta                                                                #
  #                                                                                                                            #
  #           Packages Called        :  NA                                                                                     #
  #           Packages Used via NS   :  NA                                                                                     #
  #                                                                                                                            #
  #  -----------------------------------------------------------------------------------------------------------------------   #
  #                                                                                                                            #
  #                                                                                                                            #
  #                                                                                                                            #
  #                                                                                                                            #
  #                                                     <END FUNCS>                                                            #
  #  -----------------------------------------------------------------------------------------------------------------------   #
  # -------------------------------------------------------------------------------------------------------------------------  #

# ggBubblePlot.R

# FROM @Didzis Elferts 
# http://stackoverflow.com/questions/15840926/categorical-bubble-plot-for-mapping-studies/15841998#15841998


  if (FALSE)  {

  # calculate the radius 
  myDF$radius <- sqrt( myDF$count / pi )

  # Create the plot
  ggplot(myDF,aes(Var1, Var2))+
    
    # add a drop shadow.  slightly large and minor dodge
    geom_point(aes(size=radius*7.8), position=position_dodge(width=.05), shape=21,fill="#333333", color="#999999")+

    # plot according to the radius
    geom_point(aes(size=radius*7.5),shape=21,fill="white")+

    # add the count value
    geom_text(aes(label=count),size=4) +

    # scale it
    scale_size_identity()+

    # change the background and label directions
    theme(panel.grid.major=element_line(linetype=2,color="black"),
          axis.text.x=element_text(angle=90,hjust=1,vjust=0))



  #________________________________________________________________________________________#
  ## SAMPLE DATA
  myDF <- structure(list(Var1 = structure(c(3L, 4L, 1L, 7L, 8L, 2L, 6L, 5L, 3L, 4L, 3L, 1L, 3L, 7L, 3L, 8L, 3L, 2L, 3L, 6L, 3L, 5L), .Label = c("Active.Learning..general.", "Case.based.Learning", "Does.Not.apply", "Not.specified", "Other", 
                    "Peer.Learning", "Problem.based.Learning", "Project.Method"), class = "factor"), Var2 = structure(c(3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 1L, 1L, 7L, 7L, 8L, 8L, 2L, 2L, 6L, 6L, 5L, 5L), .Label = c("Active.Learning..general.", 
                    "Case.based.Learning", "Does.Not.apply", "Not.specified", "Other", "Peer.Learning", "Problem.based.Learning", "Project.Method"), class = "factor"), count = c(53L, 15L, 1L, 2L, 4L, 22L, 6L, 1L, 15L, 15L, 1L, 1L, 2L, 2L, 4L, 4L, 22L, 22L, 6L, 6L, 
                    1L, 1L)), .Names = c("Var1", "Var2", "count"), class = "data.frame", row.names = c(NA, -22L))
  #________________________________________________________________________________________#

}
