Provides a formula interface to 'ggplot2' graphics.

The ggformula system

The functions in ggformula provide a formula interface to ggplot2 layer functions and a system for working with pipes to create multi-layer plots and to refine plots. For plots with just one layer, the formula interface is more compact than native ggplot2 code and is consistent with modeling functions like stats::lm() that use a formula interface and with the numerical summary functions in the mosaic package.

Specifying plot attributes

Positional attributes (a.k.a aesthetics) are typically specified using a formula (see the gformula argument). Setting and mapping of additional attributes can be done through the use of additional arguments. Attributes can be set can be set using arguments of the form attribute = value or mapped using arguments of the form attribute = ~ expression. A (sometimes partial) list of available attributes can be obtained by executing plotting functions with no arguments.

In formulas of the form A | B, B will be used to form facets using facet_wrap() or facet_grid(). This provides an alternative to gf_facet_wrap() and gf_facet_grid() that is terser and may feel more familiar to users of lattice.

Evaluation

Evaluation of the ggplot2 code occurs in the environment specified by environment. This will typically do the right thing, but is exposed in case some non-standard behavior is desired. In earlier versions, the environment of the formula was used, but since some functions in the package do not require a formula, a separate argument is used now.

Author

Maintainer: Randall Pruim rpruim@calvin.edu

Authors:

Examples

apropos("gf_")
#>   [1] "gf_abline"                     "gf_area"                      
#>   [3] "gf_ash"                        "gf_bar"                       
#>   [5] "gf_barh"                       "gf_bin2d"                     
#>   [7] "gf_blank"                      "gf_boxplot"                   
#>   [9] "gf_boxploth"                   "gf_coefline"                  
#>  [11] "gf_col"                        "gf_colh"                      
#>  [13] "gf_contour"                    "gf_contour_filled"            
#>  [15] "gf_count"                      "gf_counts"                    
#>  [17] "gf_countsh"                    "gf_crossbar"                  
#>  [19] "gf_crossbarh"                  "gf_curve"                     
#>  [21] "gf_dens"                       "gf_dens2"                     
#>  [23] "gf_density"                    "gf_density2d"                 
#>  [25] "gf_density2d_filled"           "gf_density_2d"                
#>  [27] "gf_density_2d_filled"          "gf_density_ridgeline_gradient"
#>  [29] "gf_density_ridges"             "gf_density_ridges2"           
#>  [31] "gf_density_ridges_gradient"    "gf_dhistogram"                
#>  [33] "gf_dhistogramh"                "gf_dist"                      
#>  [35] "gf_dotplot"                    "gf_ecdf"                      
#>  [37] "gf_ellipse"                    "gf_empty"                     
#>  [39] "gf_errorbar"                   "gf_errorbarh"                 
#>  [41] "gf_facet_grid"                 "gf_facet_wrap"                
#>  [43] "gf_fitdistr"                   "gf_frame"                     
#>  [45] "gf_freqpoly"                   "gf_fun"                       
#>  [47] "gf_fun2d"                      "gf_fun_2d"                    
#>  [49] "gf_fun_contour"                "gf_fun_tile"                  
#>  [51] "gf_function"                   "gf_function2d"                
#>  [53] "gf_function_2d"                "gf_function_contour"          
#>  [55] "gf_function_tile"              "gf_hex"                       
#>  [57] "gf_histogram"                  "gf_hline"                     
#>  [59] "gf_jitter"                     "gf_label"                     
#>  [61] "gf_labs"                       "gf_lims"                      
#>  [63] "gf_line"                       "gf_linerange"                 
#>  [65] "gf_linerangeh"                 "gf_lm"                        
#>  [67] "gf_path"                       "gf_percents"                  
#>  [69] "gf_percentsh"                  "gf_plot"                      
#>  [71] "gf_point"                      "gf_pointrange"                
#>  [73] "gf_pointrangeh"                "gf_polygon"                   
#>  [75] "gf_props"                      "gf_propsh"                    
#>  [77] "gf_qq"                         "gf_qqline"                    
#>  [79] "gf_qqstep"                     "gf_quantile"                  
#>  [81] "gf_raster"                     "gf_rect"                      
#>  [83] "gf_refine"                     "gf_relabel"                   
#>  [85] "gf_ribbon"                     "gf_ridgeline"                 
#>  [87] "gf_rug"                        "gf_rugx"                      
#>  [89] "gf_rugy"                       "gf_segment"                   
#>  [91] "gf_sf"                         "gf_sina"                      
#>  [93] "gf_smooth"                     "gf_spline"                    
#>  [95] "gf_spoke"                      "gf_step"                      
#>  [97] "gf_summary"                    "gf_text"                      
#>  [99] "gf_theme"                      "gf_tile"                      
#> [101] "gf_violin"                     "gf_violinh"                   
#> [103] "gf_vline"                     
gf_point()
#> gf_point() uses 
#>     * a formula with shape y ~ x. 
#>     * geom:  point 
#>     * key attributes:  alpha, color, size, shape, fill, group, stroke
#> 
#> For more information, try ?gf_point