how to find the list of different geoms and aesthe

2020-07-05 05:56发布

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?

标签: r ggplot2
2条回答
虎瘦雄心在
2楼-- · 2020-07-05 06:10

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
查看更多
再贱就再见
3楼-- · 2020-07-05 06:22

The actual documentation has a detailed and very handy list as well

 http://docs.ggplot2.org/current/
查看更多
登录 后发表回答