Changing the symbol in the legend key in 0.9.2

59 views
Skip to first unread message

Sandy Muspratt

unread,
Sep 6, 2012, 5:22:14 AM9/6/12
to ggp...@googlegroups.com

When using an aesthetic in geom_text, the symbol that appears in the legend key is a lower case "a". Some time ago, I asked on Stack Exchange if it was possible to change the symbol to, say, an upper case "N".  Kohske Takahashi provided the answer. The following code worked using version 0.9.1. The legend symbol was an upper case "N".

      library(ggplot2)
      library(grid)
      df <- expand.grid(x = factor(seq(1:5)), y = factor(seq(1:5)))
      df$Count = seq(1:25)

      ggplot(data = df, aes( x = x, y = y, label = Count, size = Count)) +
          geom_text() +
          scale_size(range = c(2, 10))

      grid.gedit("^key-[-0-9]+$", label = "N")

However, using version 0.9.2, the last line generates an error:
      Error in editDLfromGPath(gPath, specs, strict, grep, global, redraw) :  'gPath' (^key-[-0-9]+$) not found 
and the symbol remains a lower case "a".

Is there a way to change the symbol in the legend key in version 0.9.2?


> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252  
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                     
[5] LC_TIME=English_Australia.1252   

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods 
[8] base    

other attached packages:
[1] ggplot2_0.9.2

loaded via a namespace (and not attached):
 [1] colorspace_1.1-1   dichromat_1.2-4    digest_0.5.2       gtable_0.1.1     
 [5] labeling_0.1       MASS_7.3-21        memoise_0.1        munsell_0.3      
 [9] plyr_1.7.1         proto_0.3-9.2      RColorBrewer_1.0-5 reshape2_1.2.1   
[13] scales_0.2.2       stringr_0.6.1    

Reply all
Reply to author
Forward
0 new messages