Skip to content
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

CairoMakie poly only respects transparency when setting alpha in color #3735

Closed
pfuchter opened this issue Mar 25, 2024 · 5 comments · Fixed by #4721
Closed

CairoMakie poly only respects transparency when setting alpha in color #3735

pfuchter opened this issue Mar 25, 2024 · 5 comments · Fixed by #4721
Labels
bug CairoMakie This relates to CairoMakie, the vector backend for Makie based on Cairo. colors color, colormap, colorrange, alpha, etc rendering typically backend specific

Comments

@pfuchter
Copy link

If you set the transparency of a poly using alpha, it does not work. It only works if you set it as part of the color attribute

MWE:

  x1 = [0.,1,1,0,0]
  y1 = [0.,0,1,1,0]
  
  x2 = [0.5,1.5,1.5,0.5,0.5]
  y2 = [0.5,0.5,1.5,1.5,0.5]

  f1 = Figure()
  ax1 = Axis(f1[1,1],title="good")
  poly!(ax1,hcat(x1,y1),color=(:red,0.5))
  poly!(ax1,hcat(x2,y2),color=(:blue,0.5))

  ax2 = Axis(f1[1,2],title="bad")
  poly!(ax2,hcat(x1,y1),color=:red,alpha=0.5)
  poly!(ax2,hcat(x2,y2),color=:blue,alpha=0.5)
  
  save("test.pdf",f1)

image

@pfuchter pfuchter added the bug label Mar 25, 2024
@asinghvi17 asinghvi17 added the CairoMakie This relates to CairoMakie, the vector backend for Makie based on Cairo. label Mar 25, 2024
@asinghvi17
Copy link
Member

Which Makie versions was this on?

@pfuchter
Copy link
Author

CairoMakie v0.11.9

@asinghvi17
Copy link
Member

I can confirm this is also an issue on the 0.21 branch.

iTerm2 FTctsj

@jerlich
Copy link

jerlich commented Mar 29, 2024

this pops up also in density plots.

@ffreyer ffreyer added rendering typically backend specific colors color, colormap, colorrange, alpha, etc labels Aug 27, 2024
@ffreyer
Copy link
Collaborator

ffreyer commented Aug 27, 2024

The example doesn't work for me anymore (did we remove a conversion?). Updated version:

begin
    x1 = [0.,1,1,0,0]
    y1 = [0.,0,1,1,0]
    
    x2 = [0.5,1.5,1.5,0.5,0.5]
    y2 = [0.5,0.5,1.5,1.5,0.5]
  
    f1 = Figure()
    ax1 = Axis(f1[1,1],title="good")
    poly!(ax1,Point2f.(x1,y1),color=(:red,0.5))
    poly!(ax1,Point2f.(x2,y2),color=(:blue,0.5))
  
    ax2 = Axis(f1[1,2],title="bad")
    poly!(ax2,Point2f.(x1,y1),color=:red,alpha=0.5)
    poly!(ax2,Point2f.(x2,y2),color=:blue,alpha=0.5)
    f1
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug CairoMakie This relates to CairoMakie, the vector backend for Makie based on Cairo. colors color, colormap, colorrange, alpha, etc rendering typically backend specific
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants