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

Providing some basic visualization tools #14

Open
bennibolm opened this issue Feb 6, 2024 · 0 comments
Open

Providing some basic visualization tools #14

bennibolm opened this issue Feb 6, 2024 · 0 comments
Labels
documentation Improvements or additions to documentation visualization

Comments

@bennibolm
Copy link
Collaborator

bennibolm commented Feb 6, 2024

We could add some basic visualization routines using Plots.jl (and create a documentation section about it).

For instance, this is what I use right now:

Plotting only the points:

scatter(data_points[1, :], data_points[2, :], legend=false, title="points")

points

Adding triangulation to the plot:

for element in axes(vertices, 2)
    v1 = vertices[1, element]
    v2 = vertices[2, element]
    v3 = vertices[3, element]
    x1 = data_points[:, v1]
    x2 = data_points[:, v2]
    x3 = data_points[:, v3]
    plot!(p, [x1[1], x2[1]], [x1[2], x2[2]])
    plot!(p, [x2[1], x3[1]], [x2[2], x3[2]])
    plot!(p, [x3[1], x1[1]], [x3[2], x1[2]])
end
plot!(title = "triangles")

points_triangles

Data points and polygons (here with :centroids):

p1 = scatter(data_points[1, :], data_points[2, :], legend=false)
for element_vor in axes(voronoi_vertices_interval, 2)
    vertex_first = voronoi_vertices_interval[1, element_vor]
    vertex_last = voronoi_vertices_interval[2, element_vor]
    for i in vertex_first:(vertex_last-1)
        v1 = voronoi_vertices[i]
        v2 = voronoi_vertices[i + 1]
        x1 = voronoi_vertices_coordinates[:, v1]
        x2 = voronoi_vertices_coordinates[:, v2]
        plot!(p1, [x1[1], x2[1]], [x1[2], x2[2]])
    end
    v1 = voronoi_vertices[vertex_last]
    v2 = voronoi_vertices[vertex_first]
    x1 = voronoi_vertices_coordinates[:, v1]
    x2 = voronoi_vertices_coordinates[:, v2]
    plot!(p1, [x1[1], x2[1]], [x1[2], x2[2]], title="mesh type: $mesh_type")
end

polgonmesh

The variables names are chosen as in the elixirs.

@bennibolm bennibolm added documentation Improvements or additions to documentation visualization labels Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation visualization
Projects
None yet
Development

No branches or pull requests

1 participant