From 6c2fc685de33346e7325b540b3dca82306d64fa4 Mon Sep 17 00:00:00 2001 From: Amitav Baruah Date: Wed, 18 Nov 2020 15:45:42 -0800 Subject: [PATCH] Update subplot arrangement to support non-uniform grids Summary: Previously, grids where the columns don't divide the number of plots evenly would error. Now, there'll just be a sparse last row. Reviewed By: bottler Differential Revision: D25069236 fbshipit-source-id: 9d2fd62f3d39bfebc07ce0a41718621fa69d6057 --- pytorch3d/vis/plotly_vis.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pytorch3d/vis/plotly_vis.py b/pytorch3d/vis/plotly_vis.py index 2968af1b..a0c09a1c 100644 --- a/pytorch3d/vis/plotly_vis.py +++ b/pytorch3d/vis/plotly_vis.py @@ -692,10 +692,9 @@ def _gen_fig_with_subplots(batch_size: int, ncols: int, subplot_titles: List[str Returns: Plotly figure with ncols subplots per row, and batch_size subplots. """ - if batch_size % ncols != 0: - msg = "ncols is invalid for the given mesh batch size." - warnings.warn(msg) fig_rows = batch_size // ncols + if batch_size % ncols != 0: + fig_rows += 1 # allow for non-uniform rows fig_cols = ncols fig_type = [{"type": "scene"}] specs = [fig_type * fig_cols] * fig_rows