28 lines
875 B
Python
28 lines
875 B
Python
import vispy.plot as vp
|
|
import numpy as np
|
|
|
|
def render2D(values:list):
|
|
"""
|
|
Render a 2D plot using vispy
|
|
:param values: A list with the values
|
|
"""
|
|
fig = vp.Fig(size=(600, 500), show=False)
|
|
plotwidget = fig[0, 0]
|
|
fig.title = "bollu"
|
|
plotwidget.plot(values)
|
|
plotwidget.colorbar(position="top", cmap="autumn")
|
|
fig.show(run=True)
|
|
|
|
def cross_section(x_values:list, y_values:list):
|
|
"""
|
|
Render a 2D cross section using vispy
|
|
:param x: A list with the x values
|
|
:param y: A list with the y values
|
|
"""
|
|
color = (0.3, 0.5, 0.8)
|
|
fig = vp.Fig(show=False)
|
|
line = fig[0:4, 0:4].plot(np.column_stack((x_values,y_values)), symbol='o', width=0,
|
|
face_color=color + (0.02,), edge_color=None,
|
|
marker_size=8)
|
|
line.set_gl_state(depth_test=False)
|
|
fig.show(run=True) |