创建自定义主题

您可以基于内置主题之一自定义主题,然后使用以下方式全局应用:

code.matlab
# 基于 DocumentTheme 创建主题
my_theme = pv.plotting.themes.DocumentTheme()
my_theme.cmap = 'jet'
my_theme.show_edges = True
# 全局应用
pv.global_theme.load_theme(my_theme)

或者,您可以将主题保存到磁盘以便以后使用:

code.matlab
my_theme.save('my_theme.json')

然后在 pyvista 的新会话中加载:

code.matlab
pv.global_theme.load_theme('my_theme.json')