Open lassepe opened 3 years ago
visual(Scatter; alpha = 0.5)
should work, do you have an example when it doesn't? That being said, alpha
is the only attribute that is added compared to Makie. Ideally it should be implemented in Makie, but I guess if that doesn't happen anytime soon one can document it here.
Here is a minimal example that fails to make the scatter points transparent for
using AlgebraOfGraphics: Scatter, data, draw, mapping, visual
import CairoMakie, ElectronDisplay
df = [(; x, y = sin(x)) for x in (-π):0.1:π]
data(df) * mapping(:x, :y) * visual(Scatter; alpha = 0.5) |> draw
Output:
Package versions:
[cbdf2221] AlgebraOfGraphics v0.4.6 `https://github.com/JuliaPlots/AlgebraOfGraphics.jl.git#master`
[13f3f980] CairoMakie v0.6.2 `https://github.com/JuliaPlots/Makie.jl.git:CairoMakie#master`
[d872a56f] ElectronDisplay v1.0.1
Ah, thanks for reporting that, this is definitely a bug. I think AoG has trouble applying alpha if no explicit color is passed, either via mapping
or via visual
. You can probably work around it by doing visual(color = :black, alpha = 0.5)
.
I suspect it's difficult to fix this in general from AoG, it probably needs https://github.com/JuliaPlots/Makie.jl/issues/84 for a cleaner solution.
Thank you for the quick response. Setting the color explicitly does the trick. Should I close this issue since it will essentially work once the alpha channel is supported in Makie?
I think it's best to keep it open (even if it's not really actionable) as a reminder to update things on this end (remove current partial implementation) once Makie has alpha transparency support.
Bump. As this issue has been open for awhile and it is unclear for how long it will stay open, could we add a short note about that in the documentation? So even if the issue isn't fixed, new users won't struggle to find the trick?
alpha
is supported in Makie (as of July 2023). Is it an easy fix to pass the alpha on to Makie now?
Thank you for this awesome package! I'm a huge fan of grammar of graphics and I'm excited to see a native Julia implementation of this paradigm.
The tutorial and the philosophy pages of the documentation suggest that one can set the transparency of a layer via the
alpha
keyword ofvisualize
, i.e. something likevisualize(Scatter; alpha = 0.5)
. However, that does not seem to work (anymore?). It is surprisingly hard to figure out what would be the right thing to do to achieve the result.It would be great if the documentation could be updated in this regard or if the documentation could include a pointer to the relevant information about accepted keyword arguments of
visualize
(probably pointing to the Makie.jl docs?).