-
Notifications
You must be signed in to change notification settings - Fork 46
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
base: master
Are you sure you want to change the base?
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.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
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) |
Thought it'd be useful to highlight that AoG plots are "just" Makie