Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show how to modify a AoG plot using Makie #268

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/src/FAQs.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,21 @@ fg #hide
When setting the `width` and `height` dimensions of each axis manually you
will need to call `AlgebraOfGraphics.resizetocontent!(fg)` before
displaying the figure such that each axis is sized correctly.

This `.figure` field can also be used to adjust a plot using `Makie`.
See the Makie [API reference](http://makie.juliaplots.org/stable/makielayout/reference.html)
for more information.

```@example combined-3
using AlgebraOfGraphics, CairoMakie #hide

df = (x = exp.(rand(1000)),) #hide
hist2 = data(df) * mapping(:x => log => "log(x)") * histogram() #hide
fg = draw(hist2; figure = (resolution = (600, 400),)) #hide

lines(fg.figure[1, 1], 0..2pi, cos) #hide
Comment on lines +128 to +134
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To build on top of the previous example, you should be able to just do @example combined-2, without having to copy and hide what comes before.

fg.figure.content[1].xticklabelrotation = Float64(pi/6)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the example! I was thinking that it would be better IMO if here one was modifying the figure directly rather than the axes (the axes should ideally be accessed as fg.grid[i, j].axis). Maybe one could change backgroundcolor for instance, or any other figure attribute?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fg.figure.content[1].xticklabelrotation = Float64(pi/6)
only(contents(fg.figure[1, 1])).xticklabelrotation = Float64(pi/6)

is what the current Makie API prescribes I think.

fg #hide
```

See the