gg_: Transforms a natural language query into a gg object

View source: R/ggx.R

gg_R Documentation

Transforms a natural language query into a gg object

Description

Converts a natural language query into a 'gg' object, which can be directly chained to a 'ggplot'-call. Queries should be related to the styling of the plot, such as, axis label font size, axis label title, legend, and similar.

Usage

gg_(query = NULL)

Arguments

query

Character. A natural language command related to the styling of a ggplot.

Details

'gg_' calls the function 'gghelp', which maintains a database of keywords that match typical queries related to styling 'ggplot2' graphs. Based on the users natural language query, the function tries to find the best match and then returns the ggplot2 command, such that the result of a call to 'gg_' can be chained directly to a 'ggplot()' call.

Value

An object of class 'gg' from the internal class system of 'ggplot2'

See Also

gghelp

Examples


## Not run: 
library(ggplot2)
ggplot(data=iris,
mapping=aes(x=Sepal.Length,
           y=Petal.Length, color=Species))+
 geom_point()+
 gg_("rotate x-axis labels by 90°")+
 gg_("set x-axis label to 'Length of Sepal'")
 
## End(Not run)


brandmaier/ggx documentation built on Oct. 28, 2022, 11:24 p.m.