Skip to content

Commit

Permalink
fixes AoG, and found bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarusA committed Aug 7, 2024
1 parent d765a43 commit b9f940d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/gen_mds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function get_files(folders)
"textScatterLines.jl",
"gott_azimuthal.jl",
"us_states.jl",
"gapminder",
])

fpaths = "$(f)/" .* names
Expand Down
4 changes: 2 additions & 2 deletions examples/aog/MarketData.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ save("market_data2.svg", current_figure()); # hide
df = DataFrame(ohlc)
pltd = data(df[200:280,:])
plt = pltd * mapping(:timestamp, :Open => "StockChart")
plt *= mapping(fillto=:Close, color = (:Open, :Close) => isless => "Open<Close")
plt *= mapping(color = (:Open, :Close) => isless => "Open<Close") # fillto=:Close, because of this, the plot is wrong
plt *= visual(BarPlot)

with_theme(theme_dark(), size = (800,500)) do
draw(plt, palettes =(; color = [:deepskyblue, :firebrick3]))
draw(plt, scales(Color = (; palette = [:deepskyblue, :firebrick3])))
end

save("market_data3.svg", current_figure()); # hide
Expand Down
3 changes: 2 additions & 1 deletion examples/aog/density_ridges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ save("densityridges1.png", current_figure()); # hide
p_len = data(penguins)
## p_len = AoG.density()
p_len *= mapping(:flipper_length_mm, color=:species)
p_len *= visual(AoG.Density, direction=:y, offset = 1.0,
p_len *= AoG.density()
p_len *= visual(direction=:y, offset = 1.0, # direction is not working!
alpha = 0.2, strokewidth = 1.5, strokecolor = :grey20)
draw(p_len)

Expand Down
4 changes: 2 additions & 2 deletions examples/aog/penguinsAoG.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ p_len = data(penguins)
p_len *= mapping(:flipper_length_mm => (t -> t / 10) => "flipper length (cm)",
:bill_length_mm => (t -> t / 10) => "bill length (cm)")
## declare the grouping and the respective visual attribute
p_len *= mapping(color=:species, marker=:species)
p_len *= mapping(color=:species)

with_theme(theme_ggplot2(),size = (600,400), palette=palette, Scatter=(cycle=cycle,)) do
draw(p_len + p_len * linear();
draw(p_len * mapping(marker=:species) + p_len * linear();
axis = (; title="Flipper and bill length"))
end

Expand Down
6 changes: 3 additions & 3 deletions examples/aog/textScatterLines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ d = DataFrame(name = repeat(["A","B","C","D","E","F"], inner=4),
time=repeat([0,1,3,6], outer=6), value = rand(24));

pSL = data(d)
pSL *= mapping(:time, :value, color = :name, #text = :name => verbatim # now is not working :(
)
pSL *= visual(ScatterLines) # + visual(Makie.Text, align = (:center, :bottom))
pSL *= mapping(:time, :value)
pSL *= mapping(color = :name) * visual(ScatterLines) +
mapping(color = :name, text = :name => verbatim) * visual(Makie.Text, align = (:center, :bottom))
with_theme(theme_ggplot2(), size = (600,400)) do
draw(pSL)
end
Expand Down

0 comments on commit b9f940d

Please sign in to comment.