gg_: Transforms a natural language query into a gg object

Description Usage Arguments Details Value See Also Examples

View source: R/ggx.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## 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)

ggx documentation built on Jan. 22, 2021, 5:09 p.m.