Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to find the list of different geoms and aesthetics [duplicate]

Tags:

r

ggplot2

I am trying to find the list of aesthetics and geoms in the ggplot2 package for R and the problem that help(qplot) does not yield any results. I can not find a way to invoke help for only aesthetics or geoms.

What is the correct way to invoke help for aesthetics in R?

like image 748
Salvador Dali Avatar asked Apr 08 '13 23:04

Salvador Dali


1 Answers

The best approach I can think of is to look at help(aes) which gives links to

help(aes_colour_fill_alpha)
help(aes_group_order)
help(aes_linetype_size_shape)
help(aes_position)

Which summarize the various aes sub groups.

You would get to one of these if you were search for a particular aestheic (eg help(alpha) or help(group)

For a list of geoms, look at the index for the help, under G. Perhaps when the documentation for layer is completed (or started) it will spur a similar listing / sub grouping.

You could also extract the relevant exported objects within the ggplot2 namespace using

ls(pattern = '^geom_', env = as.environment('package:ggplot2'))

 ## [1] "geom_abline"     "geom_area"       "geom_bar"        "geom_bin2d"      "geom_blank"      "geom_boxplot"    "geom_contour"   
 ## [8] "geom_crossbar"   "geom_density"    "geom_density2d"  "geom_dotplot"    "geom_errorbar"   "geom_errorbarh"  "geom_freqpoly"  
## [15] "geom_hex"        "geom_histogram"  "geom_hline"      "geom_jitter"     "geom_line"       "geom_linerange"  "geom_map"       
## [22] "geom_path"       "geom_point"      "geom_pointrange" "geom_polygon"    "geom_quantile"   "geom_raster"     "geom_rect"      
## [29] "geom_ribbon"     "geom_rug"        "geom_segment"    "geom_smooth"     "geom_step"       "geom_text"       "geom_tile"      
## [36] "geom_violin"     "geom_vline"   

ggplot2 has an unexported character vector .all_aesthetics which contains all the possible aesthetics

ggplot2:::.all_aesthetics
like image 83
mnel Avatar answered Sep 28 '22 01:09

mnel