Skip to content

Commit

Permalink
group by more than one column
Browse files Browse the repository at this point in the history
  • Loading branch information
piever committed Jan 18, 2018
1 parent 2b1b03d commit a077099
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,26 @@ df |>
@df scatter(:b, :d)
```

The old syntax, passing the `DataFrame` as the first argument to the `plot` call is still supported, but has several limitations (the most important being incompatibility with user recipes):
The `@df` syntax is also compatible with Plots grouping machinery:

```julia
using RDatasets
school = RDatasets.dataset("mlmRev","Hsb82")
@df school density(:MAch, group = :Sx)
```

To group by more than one column, use a tuple of symbols:

```julia
plot(df, :a, [:b :c], colour = [:red :blue])
@df school density(:MAch, group = (:Sx, :Sector), legend = :topleft)
```

![grouped](https://user-images.githubusercontent.com/6333339/35101563-eacf9be4-fc57-11e7-88d3-db5bb47b08ac.png)

---

The old syntax, passing the `DataFrame` as the first argument to the `plot` call is no longer supported.

---

## marginalhist with DataFrames
Expand Down

0 comments on commit a077099

Please sign in to comment.