def test_volshow(): x, y, z = ipyvolume.examples.xyz() p3.volshow(x * y * z) p3.volshow(x * y * z, level=1) p3.volshow(x * y * z, opacity=1) p3.volshow(x * y * z, level_width=1) p3.save("tmp/ipyolume_volume.html")
def test_embed(): p3.clear() x, y, z = np.random.random((3, 100)) p3.scatter(x, y, z) p3.save("tmp/ipyolume_scatter_online.html", offline=False) assert os.path.getsize("tmp/ipyolume_scatter_online.html") > 0 p3.save("tmp/ipyolume_scatter_offline.html", offline=True, scripts_path='js/subdir') assert os.path.getsize("tmp/ipyolume_scatter_offline.html") > 0
def test_quiver(): x, y, z, u, v, w = np.random.random((6, 100)) p3.quiver(x, y, z, u, v, w) p3.save("tmp/ipyolume_quiver.html")
def test_scatter(): x, y, z = np.random.random((3, 100)) p3.scatter(x, y, z) p3.save("tmp/ipyolume_scatter.html")
# coordinate frame axes line segment tip arrows Xfv = Xf[:, 1, :] - Xf[:, 0, :] Yfv = Yf[:, 1, :] - Yf[:, 0, :] Zfv = Zf[:, 1, :] - Zf[:, 0, :] arrowcols = np.zeros((k, 3, 3)) arrowcols[0:k, 0, 0] = 1.0 arrowcols[0:k, 1, 1] = 1.0 arrowcols[0:k, 2, 2] = 1.0 q = p3.quiver(Xf[:, 1, :], Yf[:, 1, :], Zf[:, 1, :], Xfv[:, :], Yfv[:, :], Zfv[:, :], size=10, size_selected=5, color=arrowcols, color_selected='gray') # cylinder body surface s = p3.plot_surface(Xc, Yc, Zc, color='orange') # pass ipyvolume objects to animation controller and show p3.animation_control([Lx, Ly, Lz, q, s], interval=100) p3.show() # In[ ]: p3.save("shape_xform.html", offline=True)
def test_plot(): x, y, z = np.random.random((3, 100)) p3.plot(x, y, z) p3.save("tmp/ipyolume_plot.html")