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

add alpha (transparency) parameter to tricontourf #4800

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mikeliux
Copy link

@mikeliux mikeliux commented Feb 17, 2025

Description

Fixes #4799

This changes a couple of lines in tricontourf.jl to allow the user to pass transparency value.

Sample code

dxy = 1.0;
x = [0.0, dxy, 0.0, -dxy, 0.0, dxy/2, -dxy/2, dxy/2, -dxy/2];
y = [0.0, 0.0, dxy, 0.0, -dxy, dxy/2, dxy/2, -dxy/2, -dxy/2];
@. f1(x,y) = x^2 + y^2;
z = f1(x,y);

f = Figure()
ax1=Axis(f[1,1], title = "alpha = 1.0 (default)")
ax2=Axis(f[1,2], title = "alpha = 0.5 (semitransparent)")
hlines!(ax1, [-0.5, 0.0, 0.5])
hlines!(ax2, [-0.5, 0.0, 0.5])
tricontourf!(ax1, x, y, z, levels = 3)
tricontourf!(ax2, x, y, z, levels = 3, alpha=0.5)
f

transparent_polygon

Type of change

Delete options that do not apply:

  • New feature (non-breaking change which adds functionality)

Checklist

  • Added an entry in CHANGELOG.md (for new features and breaking changes)
  • Added or changed relevant sections in the documentation
  • Added reference image tests for new plotting functions, recipes, visual options, etc.

@mikeliux mikeliux force-pushed the add-tricontourf-alpha-transparency branch from 2f5aad7 to 2a7fbba Compare February 18, 2025 11:23
Copy link
Member

@asinghvi17 asinghvi17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@mikeliux mikeliux marked this pull request as ready for review February 20, 2025 10:56
@mikeliux
Copy link
Author

I am marking this PR as completed, since I understand that adding a reference image is done directly by the code reviewers
Otherwise, please let me know what is missing. This would be my first contribution.

@jkrumbiegel
Copy link
Member

The images look different on CairoMakie compared to (W)GLMakie, doesn't that look like a bug in (W)GLMakie?
image

That wouldn't be caused by this PR but it should be fixed before the reference images here can be merged.

@SimonDanisch
Copy link
Member

Looks like a different z-ordering?

@ffreyer
Copy link
Collaborator

ffreyer commented Feb 21, 2025

Not the only case
grafik

I don't think we need to hold this pr for that issue. We can just update the refimages when we fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Work in progress
Development

Successfully merging this pull request may close these issues.

add alpha (transparency) parameter to tricontourf
5 participants