-
-
Notifications
You must be signed in to change notification settings - Fork 290
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
Tricontourf plot #2226
Tricontourf plot #2226
Conversation
Compile Times benchmarkNote, that these numbers may fluctuate on the CI servers, so take them with a grain of salt. All benchmark results are based on the mean time and negative percent mean faster than the base branch. Note, that GLMakie + WGLMakie run on an emulated GPU, so the runtime benchmark is much slower. Results are from running: using_time = @ctime using Backend
# Compile time
create_time = @ctime fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @ctime Makie.colorbuffer(display(fig))
# Runtime
create_time = @benchmark fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @benchmark Makie.colorbuffer(display(fig))
|
Missing reference imagesFound 3 new images without existing references. |
This looks super cool! 💜 It seems like it always computes the connectivity pattern between the points ( |
Oh sure that could definitely be an option. I don't really know much about tricontourf plots and just implemented what I thought was the most common usage pattern. You could look in the source where I pass the list of triangles to the contour generating function and just pass your triangles in there and see if it works? We could just make the triangulation mode an attribute and maybe the default would be |
I have no idea if the contour generation function needs a specific form of triangulation though. |
I just added the option to pass a matrix as triangles (probably should add a vector of triangle faces from GeometryBasics as well, and it seems fine: using CairoMakie
x = [0.0, 0.5, 1.0, 0.25, 0.75, 0.5]
y = sqrt(3)/2*[0.0, 0.0, 0.0, 0.5, 0.5, 1.0]
z = [0.0, 0.5, 0.0, 1.0, 1.0, 0.0]
f, ax, _ = tricontourf(x, y, z, triangles = [
1 2 4
2 3 5
4 5 6
]')
scatter!(x, y, color = z, strokewidth = 1, strokecolor = :black)
tricontourf(f[1, 2], x, y, z, triangles = Makie.DelaunayTriangulation())
scatter!(x, y, color = z, strokewidth = 1, strokecolor = :black)
f |
Missing reference imagesFound 3 new images without existing references. |
Cool, that's good to know! I'll continue with that path then. Maybe I'll call the parameter |
Missing reference imagesFound 4 new images without existing references. |
Missing reference imagesFound 4 new images without existing references. |
Missing reference imagesFound 4 new images without existing references. |
Missing reference imagesFound 4 new images without existing references. |
Missing reference imagesFound 4 new images without existing references. |
Missing reference imagesFound 4 new images without existing references. |
This needs some refactoring so that code duplication with contourf is reduced. Also, currently each triangle generates its own polygon for each band, so we get edge artifacts in CairoMakie, but not GLMakie: Even though the bands run continuously across several triangles, the triangle borders are always visible with white artifacts. Edit: We might work-around this issue by just dispatching on |
Missing reference imagesFound 4 new images without existing references. |
Should be ok now |
Missing reference imagesFound 4 new images without existing references. |
Missing reference imagesFound 4 new images without existing references. |
Just wanted to say thank you for creating this! Have a year ago I posted a hacky and ugly coded version of it on discourse (and got some help making it work!). And now it's a full blown recipe inside Makie! Greatly appreciated! |
* initial attempt of tricontourf * use miniqhull instead * use modified implementation of getting contours * add docs page * colormap example * add colorbar to docs * add visual tests * add compat bounds * use static rng * add option to pass matrix of triangles instead * shift to separate file * add triangulation example * add same example to tests * add news * fix missing contours * type plot function correctly for method errors * add CairoMakie tricontourf override * map(Point2f * factor out shared code between contourf and tricontourf Co-authored-by: Simon <sdanisch@protonmail.com>
Description
Adds a tricontourf plot type.
Type of change
Delete options that do not apply:
Checklist