Skip to content

Commit 5c9485c

Browse files
Amitav Baruahfacebook-github-bot
authored andcommitted
Add note explaining plotly visualizations
Summary: Add markdown note explaining why PyTorch3D has plotly visualizations, examples, and how to save these visualizations as an image. Reviewed By: nikhilaravi Differential Revision: D23976283 fbshipit-source-id: cbbaffd1f0ebe3466841e42fdb454d85773152cd
1 parent a03fd73 commit 5c9485c

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed
46.3 KB
Loading
70.8 KB
Loading
53.3 KB
Loading

docs/notes/visualization.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
hide_title: true
3+
sidebar_label: Plotly Visualization
4+
---
5+
6+
# Overview
7+
8+
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.
9+
10+
11+
# Examples
12+
13+
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.
14+
15+
# Saving plots to images
16+
17+
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/).
18+
19+
Install Kaleido
20+
```
21+
$ pip install Kaleido
22+
```
23+
Export a figure as a .png image. The image will be saved in the current working directory.
24+
```
25+
fig = ...
26+
fig.write_image("image_name.png")
27+
```

0 commit comments

Comments
 (0)