Open axsk opened 7 years ago
I think this is only in the GKS window. If you save the plot to a png the alpha value is shown.
alpha also works in Juno for me.
cc @jheinen, though we may not need to do anything about this given the coming new terminals
Transparency is not supported in the low-level X11 backend, which is the default on console based U*ix systems. This will change in the near future ...
Is this related?
c=[RGBA(colorant"white", 0.5) RGBA(colorant"black", 0.5) RGBA(colorant"blue", 0.5)]
scatter([1 1.2 1.1], [1 1.1 1.2], color=c, markersize=30,
xlims=(0,2), ylims=(0,2))
Weirdly, this works (sort of) as expected:
c2=[colorant"white" colorant"black" colorant"blue"]
scatter([1 1.2 1.1], [1 1.1 1.2], color=c, markersize=30, markeralpha=[0.5 0.5 0.5],
xlims=(0,2), ylims=(0,2))
It's a little odd that white becomes grey with the alpha on, and the blue is darker than expected, but at least some transparency works.
NOTE: this is for both Atom and for the exported PNGs (which is what I posted here)
I think, it's not related. But I'll check ...
@jheinen ok, let me know. I'll open a separate issue if not.
@kescobo : the RGBA values that are passed to GR.jl
are definitively wrong, but I could not (yet) figure out why. The problem is in the gr.jl
backend part ...
I think we have to decide generally, what we expect from:
plot(rand(10), linecolor = RGBA(1, 0, 0, 0.5), linealpha = 1)
plot(rand(10), linecolor = RGBA(1, 0, 0, 1), linealpha = 0.5)
plot(rand(10), linecolor = RGBA(1, 0, 0, 0.5), linealpha = 0.5)
The gr backend uses the linealpha
value. Other backends may or may not use the the alpha value from RGBA ... I'm not sure right now.
Should we multiply the two alpha values for the displayed alpha or take the minimum?
We also have a similar issue with plot(rand(10), title = "my title", titlecolor = :red, titlefont = font(20, :blue))
@daschw You raise a good point. My first impulse is that I'd expect linealpha
to override an alpha that's set inside the color. So your first example would have an alpha of 1
, and the other two would both be 0.5
.
This way I can pass a bunch of colors with various alphas, but if in some cases I want them to all be full strength (or all really dim), I can set the global parameter. This strikes me as a more common operation than for example wanted to dim all colors by 50% from their present alpha.
I definitely wouldn't expect it to take the minimum value. But I can see from a practical perspective (eg if default linealpha
value is 1 and this overrides the color, that wouldn't make sense). So perhaps multiplying is the most parsimonious?
Well, seriesalpha
, linealpha
, ... default to nothing
so your first impulse proposal actually is not that impractical and I think it really makes sense.
I'm a bit on the fence, I think that makes sense, but multiplying would also make sense, e.g. if you're in an interactive environment and want to change the overall transparency (e.g. on a slider) but keep the relationships constant. I'm happy (and sad :-) ) about whatever you'll pick.
does ignore the alpha value assignment. It does work with PyPlot though.