MWE:
using CairoMakie
set_theme!(theme_latexfonts())
update_theme!(
palette=(color=ColorSchemes.glasbey_category10_n256.colors,),
ScatterLines=(cycle=Cycle(:color),)
)
function main()
f = Figure()
ax = Axis(f[1, 1])
for i in 1:1
scatterlines!(ax, 0:127, rand(128), label=string(i), alpha=0.5)
lines!(ax, 0:127, rand(128), label=string(i), alpha=0.5)
end
Legend(f[1, 2], ax, "Some Title", framevisible=false)
ax.xlabel = "x-axis"
ax.ylabel = "y-axis"
resize_to_layout!(f)
display(f)
end
main()
It seems like the alpha keyword is possibly ignored in scatterlines
? Or perhaps I am doing something wrong again. The same thing happens in a fresh julia session after commenting out the lines to do with theming.
nilshg
July 12, 2024, 9:34am
2
It’s always good to take the “M” in MWE seriously to make life easy for others. In this case you probably want:
scatterlines(rand(10); alpha = 0.1)
which indeed doesn’t work. There’s a bit of alpha
whack-a-mole in the Makie repo:
opened 03:25PM - 27 Jul 23 UTC
bug
First of all, thank you for landing support for the `alpha` keyword in Makie! :t… ada: I am enjoying that feature quite a lot!
I found what seems to be an edge case with that feature: `Makie.boxplot` seems to ignore this keyword (at least in GLMakie).
```julia
using GLMakie
data = rand(100)
boxplot(ones(length(data)), data; color = :black, alpha = 0.5)
```
![image](https://github.com/MakieOrg/Makie.jl/assets/10076790/bb32c981-737e-4eac-875a-7f42e19cf213)
Expected result:
```julia
boxplot(ones(length(data)), data; color = (:black,0.5))
```
![image](https://github.com/MakieOrg/Makie.jl/assets/10076790/43c0b070-0f5e-49d7-adf5-1d853e31fb77)
opened 06:49PM - 06 Nov 23 UTC
bug
good first issue
CairoMakie
```julia
f = Figure()
ax1 = Axis(f[1, 1], title="alpha = 0.5")
ax… 2 = Axis(f[1, 2], title="color = (:red, 0.5)")
xs = 1:10
lower, upper = fill(-1.0, 10), fill(1.0, 10)
band!(ax1, xs, lower, upper, color=:red, alpha=0.5)
band!(ax2, xs, lower, upper, color=(:red, 0.5))
```
![makie_issue](https://github.com/MakieOrg/Makie.jl/assets/39778698/702ed9e0-7a70-4e43-9112-694f737c6d6d)
opened 03:59PM - 13 Dec 23 UTC
enhancement
I am often in the situation where I just want to add some alpha (transparency) t… o a plot, without making changes to colors. So I would like to use the default colours, or one specified with `Cycled`, but with some alpha != 1.. However, I have been unable to find a way to do this without manually specifying a color.
Perhaps it would be feasable to add field "alpha" to `Cycled`? It could then be `Cycled(1, 0.5)`, analogus to `(:black, 0.5)`.
opened 01:26PM - 29 May 24 UTC
bug
regression
On GLMakie 0.9 with Makie 0.20, `hist(rand(100); alpha = 0.5)` produces a histog… ram with opaque bars.
On GLMakie 0.10 with Makie 0.21 I get:
```
Invalid attribute alpha for plot type Plot{Makie.hist}.
The available plot attributes for Plot{Makie.hist} are:
bar_labels fillto label_formatter over_background_color weights
bins flip_labels_at label_offset over_bar_color
color gap label_size scale_to
cycle label_color normalization strokecolor
direction label_font offset strokewidth
```
So feel free to add your issue I guess? Maybe @jules @sdanisch have other plans on how to deal with this more generally?
Thanks for the tip, I’ll have to remind myself what minimal means lol. Unfortunate to see this is an issue in other parts of Makie as well
I think you can use
scatterlines(rand(10), color=(Makie.wong_colors()[1],0.5))
Unfortunately, you cannot use color=(Cycled(1),0.5)
, but I think there was an issue already opened for this.
1 Like
Thank you, your suggestion works well! I was able to use it with ColorSchemes.glasbey_category10_n256.colors[i], 0.7