def visdom_plot_pointclouds()

in tools/vis_utils.py [0:0]


def visdom_plot_pointclouds(viz, pcl, visdom_env, title,
                            plot_legend=True, markersize=2,
                            nmax=5000, sticks=None, win=None):

    if sticks is not None:
        pcl = {k: extend_to_3d_skeleton_simple(v, sticks)[0]
               for k, v in pcl.items()}

    legend = list(pcl.keys())

    cmap = 'tab10'
    npcl = len(pcl)
    rgb = (cm.get_cmap(cmap)(np.linspace(0, 1, 10))
           [:, :3]*255.).astype(np.int32).T
    rgb = np.tile(rgb, (1, int(np.ceil(npcl/10))))[:, 0:npcl]

    rgb_cat = {k: np.tile(rgb[:, i:i+1], (1, p.shape[1])) for
               i, (k, p) in enumerate(pcl.items())}

    rgb_cat = np.concatenate(list(rgb_cat.values()), axis=1)
    pcl_cat = np.concatenate(list(pcl.values()), axis=1)

    if pcl_cat.shape[1] > nmax:
        with NumpySeedFix():
            prm = np.random.permutation(
                pcl_cat.shape[1])[0:nmax]
        pcl_cat = pcl_cat[:, prm]
        rgb_cat = rgb_cat[:, prm]

    win = viz.scatter(pcl_cat.T, env=visdom_env,
                      opts={'title': title, 'markersize': markersize,
                            'markercolor': rgb_cat.T}, win=win)
    # legend
    if plot_legend:
        dummy_vals = np.tile(
            np.arange(npcl)[:, None], (1, 2)).astype(np.float32)
        title = "%s_%s" % (title, legend)
        opts = dict(title=title, legend=legend, width=400, height=400)
        viz.line(dummy_vals.T, env=visdom_env, opts=opts)

    return win