本文整理汇总了Python中pyvista.OFF_SCREEN属性的典型用法代码示例。如果您正苦于以下问题:Python pyvista.OFF_SCREEN属性的具体用法?Python pyvista.OFF_SCREEN怎么用?Python pyvista.OFF_SCREEN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类pyvista
的用法示例。
在下文中一共展示了pyvista.OFF_SCREEN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_plot_show_bounds
# 需要导入模块: import pyvista [as 别名]
# 或者: from pyvista import OFF_SCREEN [as 别名]
def test_plot_show_bounds():
plotter = pyvista.Plotter(off_screen=OFF_SCREEN)
plotter.add_mesh(sphere)
plotter.show_bounds(show_xaxis=False,
show_yaxis=False,
show_zaxis=False,
show_xlabels=False,
show_ylabels=False,
show_zlabels=False,
use_2d=True)
# And test backwards compatibility
plotter.add_bounds_axes(show_xaxis=False,
show_yaxis=False,
show_zaxis=False,
show_xlabels=False,
show_ylabels=False,
show_zlabels=False,
use_2d=True)
plotter.show()
示例2: test_set_background
# 需要导入模块: import pyvista [as 别名]
# 或者: from pyvista import OFF_SCREEN [as 别名]
def test_set_background():
plotter = pyvista.Plotter(off_screen=OFF_SCREEN)
plotter.set_background('k')
plotter.background_color = "yellow"
plotter.set_background([0, 0, 0], top=[1,1,1]) # Gradient
_ = plotter.background_color
plotter.show()
plotter = pyvista.Plotter(off_screen=OFF_SCREEN, shape=(1,2))
plotter.set_background('orange')
for renderer in plotter.renderers:
assert renderer.GetBackground() == pyvista.parse_color('orange')
plotter.show()
plotter = pyvista.Plotter(off_screen=OFF_SCREEN, shape=(1,2))
plotter.subplot(0,1)
plotter.set_background('orange', all_renderers=False)
assert plotter.renderers[0].GetBackground() != pyvista.parse_color('orange')
assert plotter.renderers[1].GetBackground() == pyvista.parse_color('orange')
plotter.show()
示例3: test_plot_rgb
# 需要导入模块: import pyvista [as 别名]
# 或者: from pyvista import OFF_SCREEN [as 别名]
def test_plot_rgb():
""""Test adding a texture to a plot"""
cube = pyvista.Cube()
cube.clear_arrays()
x_face_color = (255, 0, 0)
y_face_color = (0, 255, 0)
z_face_color = (0, 0, 255)
face_colors = np.array([x_face_color,
x_face_color,
y_face_color,
y_face_color,
z_face_color,
z_face_color,
], dtype=np.uint8)
cube.cell_arrays['face_colors'] = face_colors
plotter = pyvista.Plotter(off_screen=OFF_SCREEN)
plotter.add_mesh(cube, scalars='face_colors', rgb=True)
plotter.show()
示例4: test_link_views
# 需要导入模块: import pyvista [as 别名]
# 或者: from pyvista import OFF_SCREEN [as 别名]
def test_link_views():
plotter = pyvista.Plotter(shape=(1, 4), off_screen=OFF_SCREEN)
sphere = pyvista.Sphere()
plotter.subplot(0, 0)
plotter.add_mesh(sphere, smooth_shading=False, show_edges=False)
plotter.subplot(0, 1)
plotter.add_mesh(sphere, smooth_shading=True, show_edges=False)
plotter.subplot(0, 2)
plotter.add_mesh(sphere, smooth_shading=False, show_edges=True)
plotter.subplot(0, 3)
plotter.add_mesh(sphere, smooth_shading=True, show_edges=True)
with pytest.raises(TypeError):
plotter.link_views(views='foo')
plotter.link_views([0, 1])
plotter.link_views()
with pytest.raises(TypeError):
plotter.unlink_views(views='foo')
plotter.unlink_views([0, 1])
plotter.unlink_views(2)
plotter.unlink_views()
plotter.show()
示例5: test_image_properties
# 需要导入模块: import pyvista [as 别名]
# 或者: from pyvista import OFF_SCREEN [as 别名]
def test_image_properties():
mesh = examples.load_uniform()
p = pyvista.Plotter(off_screen=OFF_SCREEN)
p.add_mesh(mesh)
p.show(auto_close=False) # DO NOT close plotter
# Get RGB image
_ = p.image
# Get the depth image
_ = p.get_image_depth()
p.close()
p = pyvista.Plotter(off_screen=OFF_SCREEN)
p.add_mesh(mesh)
p.store_image = True
assert p.store_image is True
p.show() # close plotter
# Get RGB image
_ = p.image
# Get the depth image
_ = p.get_image_depth()
p.close()
示例6: test_opacity_by_array
# 需要导入模块: import pyvista [as 别名]
# 或者: from pyvista import OFF_SCREEN [as 别名]
def test_opacity_by_array():
mesh = examples.load_uniform()
# Test with opacity array
mesh['opac'] = mesh['Spatial Point Data'] / 100.
p = pyvista.Plotter(off_screen=OFF_SCREEN)
p.add_mesh(mesh, scalars='Spatial Point Data', opacity='opac',)
p.show()
# Test with uncertainty array (transparency)
mesh['unc'] = mesh['Spatial Point Data']
p = pyvista.Plotter(off_screen=OFF_SCREEN)
p.add_mesh(mesh, scalars='Spatial Point Data', opacity='unc',
use_transparency=True)
p.show()
# Test using mismatched arrays
with pytest.raises(ValueError):
p = pyvista.Plotter(off_screen=OFF_SCREEN)
p.add_mesh(mesh, scalars='Spatial Cell Data', opacity='unc',)
p.show()
# Test with user defined transfer function
opacities = [0,0.2,0.9,0.2,0.1]
p = pyvista.Plotter(off_screen=OFF_SCREEN)
p.add_mesh(mesh, scalars='Spatial Point Data', opacity=opacities,)
p.show()
示例7: test_plot
# 需要导入模块: import pyvista [as 别名]
# 或者: from pyvista import OFF_SCREEN [as 别名]
def test_plot(tmpdir):
filename = os.path.join(pyvista.USER_DATA_PATH, 'tmp.png')
scalars = np.arange(sphere.n_points)
cpos, img = pyvista.plot(sphere,
off_screen=OFF_SCREEN,
full_screen=True,
text='this is a sphere',
show_bounds=True,
color='r',
style='wireframe',
line_width=10,
scalars=scalars,
flip_scalars=True,
cmap='bwr',
interpolate_before_map=True,
screenshot=filename,
return_img=True)
assert isinstance(cpos, pyvista.CameraPosition)
assert isinstance(img, np.ndarray)
assert os.path.isfile(filename)
os.remove(filename)
filename = os.path.join(pyvista.USER_DATA_PATH, 'foo')
cpos = pyvista.plot(sphere, off_screen=OFF_SCREEN, screenshot=filename)
filename = filename + ".png" # Ensure it added a PNG extension by default
assert os.path.isfile(filename)
# remove file
os.remove(filename)
示例8: test_set_camera_position
# 需要导入模块: import pyvista [as 别名]
# 或者: from pyvista import OFF_SCREEN [as 别名]
def test_set_camera_position(cpos, sphere):
plotter = pyvista.Plotter(off_screen=OFF_SCREEN)
plotter.add_mesh(sphere)
plotter.camera_position = cpos
plotter.show()
示例9: test_set_camera_position_invalid
# 需要导入模块: import pyvista [as 别名]
# 或者: from pyvista import OFF_SCREEN [as 别名]
def test_set_camera_position_invalid(cpos, sphere):
plotter = pyvista.Plotter(off_screen=OFF_SCREEN)
plotter.add_mesh(sphere)
with pytest.raises(pyvista.core.errors.InvalidCameraError):
plotter.camera_position = cpos
示例10: test_plot_no_active_scalars
# 需要导入模块: import pyvista [as 别名]
# 或者: from pyvista import OFF_SCREEN [as 别名]
def test_plot_no_active_scalars():
plotter = pyvista.Plotter(off_screen=OFF_SCREEN)
plotter.add_mesh(sphere)
with pytest.raises(ValueError):
plotter.update_scalars(np.arange(5))
with pytest.raises(ValueError):
plotter.update_scalars(np.arange(sphere.n_faces))
示例11: test_plot_show_bounds_params
# 需要导入模块: import pyvista [as 别名]
# 或者: from pyvista import OFF_SCREEN [as 别名]
def test_plot_show_bounds_params(grid, location):
plotter = pyvista.Plotter(off_screen=OFF_SCREEN)
plotter.add_mesh(pyvista.Cube())
plotter.show_bounds(grid=grid, ticks='inside', location=location)
plotter.show_bounds(grid=grid, ticks='outside', location=location)
plotter.show_bounds(grid=grid, ticks='both', location=location)
plotter.show()
示例12: test_plotter_scale
# 需要导入模块: import pyvista [as 别名]
# 或者: from pyvista import OFF_SCREEN [as 别名]
def test_plotter_scale():
plotter = pyvista.Plotter(off_screen=OFF_SCREEN)
plotter.add_mesh(sphere)
plotter.set_scale(10, 10, 10)
assert plotter.scale == [10, 10, 10]
plotter.set_scale(5.0)
plotter.set_scale(yscale=6.0)
plotter.set_scale(zscale=9.0)
assert plotter.scale == [5.0, 6.0, 9.0]
plotter.scale = [1.0, 4.0, 2.0]
assert plotter.scale == [1.0, 4.0, 2.0]
plotter.show()
示例13: test_plot_add_scalar_bar
# 需要导入模块: import pyvista [as 别名]
# 或者: from pyvista import OFF_SCREEN [as 别名]
def test_plot_add_scalar_bar():
plotter = pyvista.Plotter(off_screen=OFF_SCREEN)
plotter.add_mesh(sphere)
plotter.add_scalar_bar(label_font_size=10, title_font_size=20, title='woa',
interactive=True, vertical=True)
plotter.add_scalar_bar(background_color='white', n_colors=256)
示例14: test_plot_list
# 需要导入模块: import pyvista [as 别名]
# 或者: from pyvista import OFF_SCREEN [as 别名]
def test_plot_list():
pyvista.plot([sphere, sphere_b],
off_screen=OFF_SCREEN,
style='points')
pyvista.plot([sphere, sphere_b, sphere_c],
off_screen=OFF_SCREEN,
style='wireframe')
示例15: test_open_gif_invalid
# 需要导入模块: import pyvista [as 别名]
# 或者: from pyvista import OFF_SCREEN [as 别名]
def test_open_gif_invalid():
plotter = pyvista.Plotter(off_screen=OFF_SCREEN)
with pytest.raises(ValueError):
plotter.open_gif('file.abs')