show how to modify a AoG plot using Makie#268
Conversation
| fg = draw(hist2; figure = (resolution = (600, 400),)) #hide | ||
|
|
||
| lines(fg.figure[1, 1], 0..2pi, cos) #hide | ||
| fg.figure.content[1].xticklabelrotation = Float64(pi/6) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
| 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.
| 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 |
There was a problem hiding this comment.
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.
|
apologies--I will get to this, crunching for a paper deadline... |
|
adding a note-to-self to also contribute something on how to change ordering since took me a while to figure out using PalmerPenguins, DataFrames
penguins = dropmissing(DataFrame(PalmerPenguins.load()))
penguins.island = CategoricalArray(penguins.island, ordered=true)
levels!(penguins.island, ["Dream", "Biscoe", "Torgersen"])
first(penguins, 6)
penguin_frequency = aog.data(penguins) * frequency() * mapping(:species)
plt = penguin_frequency * mapping(color = :island, dodge = :island)
draw(plt) |
|
there's now a tutorial that shows these aspects https://aog.makie.org/v0.10.0/tutorials/intro-vi |

Thought it'd be useful to highlight that AoG plots are "just" Makie