def plot3Dgrid(rows, cols, viz_data, style, normalize=True, title=None):
if len(viz_data) > rows * cols:
raise ValueError('Number of plot data is more than the specified rows and columns.')
fig = tools.make_subplots(rows, cols, specs=[[{'is_3d': True}] * cols] * rows, print_grid=False)
if style == 'flat':
layout_3D = dict(
xaxis=dict(range=[0, 360]),
yaxis=dict(range=[0, 181]),
aspectmode='manual',
aspectratio=dict(x=3.6, y=1.81, z=1)
)
else:
layout_3D = dict(
xaxis=dict(range=[-1, 1]),
yaxis=dict(range=[-1, 1]),
zaxis=dict(range=[-1, 1]),
aspectmode='cube'
)
rows, cols = _np.mgrid[1:rows + 1, 1: cols + 1]
rows = rows.flatten()
cols = cols.flatten()
for IDX in range(0, len(viz_data)):
cur_row = rows[IDX]
cur_col = cols[IDX]
fig.append_trace(genVisual(viz_data[IDX], style=style, normalize=normalize), cur_row, cur_col)
fig.layout['scene' + str(IDX + 1)].update(layout_3D)
if title is not None:
fig.layout.update(title=title)
filename = title + '.html'
else:
filename = str(current_time()) + '.html'
if env_info() == 'jupyter_notebook':
plotly_off.iplot(fig)
else:
plotly_off.plot(fig, filename=filename)
评论列表
文章目录