def vis_pointcloud()

in contactopt/util.py [0:0]


def vis_pointcloud(object_points, hand_points, idx=None, show=True):
    if show:
        plt.switch_backend('TkAgg')
    else:
        plt.switch_backend('agg')

    if idx is None:
        idx = int(np.random.randint(0, hand_points.shape[0]))   # Select random sample from batch

    object_points = object_points[idx, :, :].detach().cpu().numpy()
    hand_points = hand_points[idx, :, :].detach().cpu().numpy()

    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    ax.scatter(object_points[:, 0], object_points[:, 1], object_points[:, 2])
    ax.scatter(hand_points[:, 0], hand_points[:, 1], hand_points[:, 2]) #, c=np.arange(hand_points.shape[0]))

    if show:
        axisEqual3D(ax)
        # plt.axis('off')
        ax.set_xlabel('X Label')
        ax.set_ylabel('Y Label')
        ax.set_zlabel('Z Label')
        plt.show()

    return fig