Skip to content

Commit

Permalink
adds makie grid integration example
Browse files Browse the repository at this point in the history
  • Loading branch information
rdboyes committed Jan 7, 2025
1 parent e5709fa commit 67d142c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,30 @@ ggplot(penguins) +

See the [documentation](https://tidierorg.github.io/TidierPlots.jl/latest) for more information and examples.

### Mix Makie Plots and Tidier Plots

TidierPlots is creating Makie `SpecApi.GridLayout` objects under the hood, so you can easily combine TidierPlots output with Makie output for more flexibility:

```julia
using WGLMakie
using DelimitedFiles
using Makie.FileIO
import Makie.SpecApi as S
using TidierPlots
using DataFrames

r = LinRange(-1, 1, 100)
cube = [(x .^ 2 + y .^ 2 + z .^ 2) for x = r, y = r, z = r]
cube_contour = S.Contour(cube, alpha=0.5)
ax_cube = S.Axis3(; plots=[cube_contour], protrusions = (50, 20, 10, 0))

d = DataFrame(r = r, r2 = r .^ 2)
gg = ggplot(d) + geom_line(aes(x = :r, y = :r2))

plot(S.GridLayout([TidierPlots.as_GridLayout(gg) ax_cube]))
```
![](assets/makie_integration.png)

# What's New

See [NEWS.md](https://github.com/TidierOrg/TidierPlots.jl/blob/main/NEWS.md) for the latest updates.
Expand Down
Binary file added assets/makie_integration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 67d142c

Please sign in to comment.