Skip to content

Commit

Permalink
add readme info about aes calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
rdboyes committed Apr 8, 2024
1 parent 8c0207c commit 83e1276
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,20 @@ You will likely want to disable both of these if you are working in a notebook e

The goal of this package is to allow you to write code that is as similar to ggplot2 code as possible. The only difference in basic usage is in the `aes()` function. TidierPlots.jl accepts two forms for aes specification, neither of which is *exactly* the same as ggplot2.

- Option 1: `@aes` macro, aes as in ggplot, e.g. `@aes(x = x, y = y)` or `@aes(x, y)`
- Option 2: `aes` function, julia-style columns, e.g. `aes(x = :x, y = :y)` or `aes(:x, :y)`
- Option 1: `aes` function, julia-style columns, e.g. `aes(x = :x, y = :y)` or `aes(:x, :y)`
- Option 2: `@aes` (or `@es`) macro, aes as in ggplot, e.g. `@aes(x = x, y = y)` or `@aes(x, y)`
- Option 3 (Deprecated): `aes` function, column names as strings, e.g. `aes(x = "x", y = "y")` or `aes("x", "y")`

If you use Option 1, you get experimental support for calculations inside aes, including `+`, `-`, `*`, `/` and function application. Functions can be applied to columns with the `>>` operator, or wrapped for aes use with the `aesthetics_function()` command. The following geom_point specifications are equivalent:

```
my_func(x) = x ./ 10
my_aes_func = aesthetics_function(my_func)
geom_point(aes(x = :x/10))
geom_point(aes(x = :x >> my_func))
geom_point(aes(x = my_aes_func(:x)))
```

## Why would I use this instead of ggplot2?

Expand Down

0 comments on commit 83e1276

Please sign in to comment.