Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This will help people learn and understand better about 3d models
Related Issue
Closes #475
Description
import pyvista as pv
from pyvista import examples
Download a sample mesh (bunny model)
mesh = examples.download_bunny_coarse()
Create a Plotter object
pl = pv.Plotter()
Add the bunny mesh to the plotter
pl.add_mesh(mesh, show_edges=True, color='white')
Add points on the mesh (for visualization, not necessary for labeling)
#pl.add_points(mesh.points, color='red', point_size=20)
Define the coordinates and labels for different parts of the bunny model
labels = {
"Ear Left": [-0.08508963,0.15244128,-0.07269581],
"Ear Right": [-0.01597024,0.13926028,-0.02299697],
"Nose": [-0.11643464,0.05128627,0.07609549],
"Bottom": [0.14346997,-0.08839463,0.04595339],
}
Add labels to the plotter
for label, coord in labels.items():
pl.add_point_labels([coord], [label], point_color='blue', point_size=10, font_size=20, text_color='black')
Set the camera position for a better view
pl.camera_position = [(0.02, 0.30, 0.73),
(0.02, 0.03, -0.022),
(-0.03, 0.94, -0.34)]
Show the plot
pl.show()
Screenshots
Checklist