diff --git a/docs/notes/assets/plotly_meshes_batch.png b/docs/notes/assets/plotly_meshes_batch.png new file mode 100644 index 00000000..975d901d Binary files /dev/null and b/docs/notes/assets/plotly_meshes_batch.png differ diff --git a/docs/notes/assets/plotly_meshes_trace.png b/docs/notes/assets/plotly_meshes_trace.png new file mode 100644 index 00000000..9e57a1fa Binary files /dev/null and b/docs/notes/assets/plotly_meshes_trace.png differ diff --git a/docs/notes/assets/plotly_pointclouds.png b/docs/notes/assets/plotly_pointclouds.png new file mode 100644 index 00000000..928d646a Binary files /dev/null and b/docs/notes/assets/plotly_pointclouds.png differ diff --git a/docs/notes/visualization.md b/docs/notes/visualization.md new file mode 100644 index 00000000..daf090dd --- /dev/null +++ b/docs/notes/visualization.md @@ -0,0 +1,27 @@ +--- +hide_title: true +sidebar_label: Plotly Visualization +--- + +# Overview + +PyTorch3D provides a modular differentiable renderer, but for instances where we want interactive plots or are not concerned with the differentiability of the rendering process, we provide [functions to render meshes and pointclouds in plotly](../../pytorch3d/visualization/plotly_vis.py). These plotly figures allow you to rotate and zoom the rendered images and support plotting batched data as multiple traces in a singular plot or divided into individual subplots. + + +# Examples + +These rendering functions accept plotly x,y, and z axis arguments as `kwargs`, allowing us to customize the plots. Here are two plots with colored axes, a [Pointclouds plot](assets/plotly_pointclouds.png), a [batched Meshes plot in subplots](assets/plotly_meshes_batch.png), and a [batched Meshes plot with multiple traces](assets/plotly_meshes_trace.png). Refer to the [render textured meshes](../tutorials/render_textured_meshes.ipynb) and [render colored pointclouds](../tutorials/render_colored_points) tutorials for code examples. + +# Saving plots to images + +If you want to save these plotly plots, you will need to install a separate library such as [Kaleido](https://plotly.com/python/static-image-export/). + +Install Kaleido +``` +$ pip install Kaleido +``` +Export a figure as a .png image. The image will be saved in the current working directory. +``` +fig = ... +fig.write_image("image_name.png") +```