Example #1
0
def test_limits():
    f = p3.figure()
    p3.xlim(-10, 11)
    assert f.xlim[0] == -10
    assert f.xlim[1] == 11

    p3.ylim(-12, 13)
    assert f.ylim[0] == -12
    assert f.ylim[1] == 13

    p3.zlim(-14, 15)
    assert f.zlim[0] == -14
    assert f.zlim[1] == 15

    p3.xyzlim(-17, 17)
    assert f.xlim[0] == -17
    assert f.xlim[1] == 17
    assert f.ylim[0] == -17
    assert f.ylim[1] == 17
    assert f.zlim[0] == -17
    assert f.zlim[1] == 17
Example #2
0
def test_limits():
    f = p3.figure()
    p3.xlim(-10, 11)
    assert f.xlim[0] == -10
    assert f.xlim[1] == 11

    p3.ylim(-12, 13)
    assert f.ylim[0] == -12
    assert f.ylim[1] == 13

    p3.zlim(-14, 15)
    assert f.zlim[0] == -14
    assert f.zlim[1] == 15

    p3.xyzlim(-17, 17)
    assert f.xlim[0] == -17
    assert f.xlim[1] == 17
    assert f.ylim[0] == -17
    assert f.ylim[1] == 17
    assert f.zlim[0] == -17
    assert f.zlim[1] == 17

    # TODO: actually, default xlim should be None, and the limits should
    # then now grow, but 'move' around the new point
    f = ipv.figure()
    assert f.xlim == [0, 1]
    ipv.ylim(0, 10)
    ipv.zlim(-10, 0)
    ipv.scatter(3, 4, 5)
    assert f.xlim == [0, 3]
    assert f.ylim == [0, 10]
    assert f.zlim == [-10, 5]

    f = ipv.figure()
    ipv.volshow(np.random.rand(5, 5, 5),
                extent=[[0.1, 0.9], [0.5, 2], [-2, 5]])
    assert f.xlim == [0, 1]
    assert f.ylim == [0, 2]
    assert f.zlim == [-2, 5]
Example #3
0
# In[ ]:

# create ipyvolume figure to display cylinder and coordinate frame transform animation
fig = p3.figure(width=480, height=480)

# set ipyvolume style properties
p3.style.background_color('black')
p3.style.box_off()
p3.style.use("dark")
p3.style.use({'xaxis.color': "red"})  # <-+
p3.style.use({'yaxis.color': "green"})  # <-+- do not appear to be working
p3.style.use({'zaxis.color': "blue"})  # <-+

# set figure view and axes
p3.view(0.0, -120.0)
p3.xyzlim(-2.0, 2.0)
p3.xyzlabel('X', 'Y', 'Z')

# coordinate frame axes line segments
Lx = p3.plot(Xf[:, 0:2, 0], Yf[:, 0:2, 0], Zf[:, 0:2, 0], color='red', size=2)
Lx.material.visible = False
Lx.line_material.visible = True
Ly = p3.plot(Xf[:, 0:2, 1], Yf[:, 0:2, 1], Zf[:, 0:2, 1], color='green')
Ly.material.visible = False
Ly.line_material.visible = True
Lz = p3.plot(Xf[:, 0:2, 2], Yf[:, 0:2, 2], Zf[:, 0:2, 2], color='blue')
Lz.material.visible = False
Lz.line_material.visible = True

# coordinate frame axes line segment tip arrows
Xfv = Xf[:, 1, :] - Xf[:, 0, :]