コード例 #1
0
    def initUI(self):
        # vispy
        #canvas = vispy.app.Canvas()
        print('start initUI')

        if 1:
            self.fig = vp.Fig(size=(800, 600), show=False)
            data = np.random.rand(100, 2)
            line1 = self.fig[0, 0].plot(data=data)
            self.fig[1, 0].plot(data=data)
            self.fig[2, 0].plot(data=data)
            self.fig[3, 0].plot(data=data)

        # qt
        #w = QtWidgets.QMainWindow()
        #widget = QtWidgets.QWidget()
        #w.setCentralWidget(widget)
        #widget.setLayout(QtWidgets.QHBoxLayout())

        self.myHBoxLayout = QtWidgets.QHBoxLayout(self)

        self.myHBoxLayout.addWidget(QtWidgets.QPushButton('A Button'))
        self.myHBoxLayout.addWidget(self.fig.native)
        #widget.layout().addWidget(QtWidgets.QPushButton('A Button'))
        #widget.layout().addWidget(self.fig.native)
        #widget.layout().addWidget(canvas.native)

        #w.show()
        #widget.show()
        #vispy.app.run()

        self.show()

        data = np.random.rand(100, 2) + 100
        line1.set_data(data)
コード例 #2
0
    def __init__(self):
        super(bTest, self).__init__()

        viewer = napari.Viewer(title='xxx')

        self.initUI()

        # vispy
        #canvas = vispy.app.Canvas()
        print('start __init__')

        if 0:
            self.fig = vp.Fig(size=(800, 600))
            data = np.random.rand(100, 2)
            self.fig[0, 0].plot(data=data)
            self.fig[1, 0].plot(data=data)
            self.fig[2, 0].plot(data=data)
            self.fig[3, 0].plot(data=data)

            # qt
            #w = QtWidgets.QMainWindow()
            widget = QtWidgets.QWidget()
            #w.setCentralWidget(widget)
            widget.setLayout(QtWidgets.QHBoxLayout())

            widget.layout().addWidget(QtWidgets.QPushButton('A Button'))
            widget.layout().addWidget(self.fig.native)
            #widget.layout().addWidget(canvas.native)

            #w.show()
            #widget.show()
            #vispy.app.run()

        print('end __init__')
コード例 #3
0
ファイル: visualise.py プロジェクト: ultraleap/HandyBeam
def visualise_translation_3D(world=None,
                             original_pressure_field=None,
                             sampler=None,
                             threshold=50,
                             colour_map='cubehelix'):
    '''
        
    This method visualises the effect of the (x-y) translation algorithm on the
    amplitude and phase of the acoustic field.

    Parameters
    ----------

    world : handybeam_core.world
            An instance of the handybeam.world class.
    original_pressure_field : numpy array
            A numpy array containing the propagated acoustic pressure field.
    sampler : handybeam.sampler
            An instance of one of the handybeam sampler classes.
    filename : string
            This string indicates the location in which the visualisation image should be stored.
    threshold : float / int
            This sets the threshold for which sampling points are visualised in the image. It can
            be modified to ignore regions with pressure less than the threshold.
    colour_map : string
            This sets the colour map to be used in the visualisation. Please see
            https://github.com/vispy/vispy/blob/master/vispy/color/colormap.py#L348-L441.

    '''

    reshape_no = int(np.round(np.power(sampler.no_points, 1 / 3), 3))
    sampler_pressure_field_reshaped = sampler.pressure_field.reshape(
        (reshape_no, reshape_no, reshape_no))
    original_pressure_field_reshaped = original_pressure_field.reshape(
        (reshape_no, reshape_no, reshape_no))

    fig = vp.Fig(bgcolor='white', size=(2000, 2000), show=False)

    vol_data_before = np.abs(original_pressure_field_reshaped)
    vol_data_before = np.flipud(np.rollaxis(vol_data_before, 1))

    vol_data_before[vol_data_before < threshold] = 0
    vol_pw_before = fig[0, 0]
    vol_pw_before.volume(vol_data_before, cmap=colour_map)

    vol_data_after = np.abs(sampler_pressure_field_reshaped)
    vol_data_after = np.flipud(np.rollaxis(vol_data_after, 1))

    vol_data_after[vol_data_after < threshold] = 0
    vol_pw_after = fig[0, 1]
    vol_pw_after.volume(vol_data_after, cmap=colour_map)

    vol_pw_before.camera = scene.cameras.TurntableCamera(fov=45)
    vol_pw_after.camera = scene.cameras.TurntableCamera(fov=45)

    vol_pw_before.camera.link(vol_pw_after.camera)

    fig.show(run=True)
コード例 #4
0
def test_figure_creation():
    """Test creating a figure"""
    with vp.Fig(show=False) as fig:
        fig[0, 0:2]
        fig[1:3, 0:2]
        ax_right = fig[1:3, 2]
        assert fig[1:3, 2] is ax_right
        # collision
        assert_raises(ValueError, fig.__getitem__, (slice(1, 3), 1))
コード例 #5
0
ファイル: plot.py プロジェクト: MatteoLacki/vispywrapper
def surface_plot(I, x=None, y=None, show=True, size=(800, 400)):
    figure = vp.Fig(size=size, show=False)
    if x is None or y is None:
        p1 = figure[0, 0].surface(zdata=I)
    else:
        p1 = figure[0, 0].surface(zdata=I, x=x, y=x)
    if show:
        figure.show(run=True)
    else:
        return figure
コード例 #6
0
def main():
    points = np.random.randn(10, 2)

    fig = vp.Fig(show=False)
    fig[0, 0].plot(points,
                   width=0,
                   face_color=(.8, .4, .2, .5),
                   edge_color=None,
                   marker_size=100.)

    fig.show(run=True)
コード例 #7
0
    def on_start(self):
        widget = self.root
        fig = vp.Fig(app='kivy_glir')
        widget.link_vispy_canvas(fig)

        plotwidget = fig[0, 0]
        # fig.title = "bollu"
        plotwidget.plot([(x, x**2) for x in range(0, 100)], title="y = x^2")
        plotwidget.colorbar(position="top", cmap="autumn")
        fig.show()
        widget.vispy_canvas_backend.kivy_draw_trigger()
コード例 #8
0
    def __init__(self):
        MainWindowBase.__init__(self)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.viewer = vp.Fig()
        self.viewer.create_native()
        self.ui.plotFrameLayout.addWidget(self.viewer.native)

        x = np.linspace(0, 10, 100000)
        y = np.cos(x)

        self.viewer[0, 0].plot((x, y))
        grid1 = vp.visuals.GridLines(color=(0, 0, 0, 0.5))
        grid1.set_gl_state('translucent')
        self.viewer[0, 0].view.add(grid1)
コード例 #9
0
ファイル: visualise.py プロジェクト: ultraleap/HandyBeam
def visualise_3D(world=None,
                 sampler=None,
                 threshold=50,
                 colour_map='cubehelix'):

    fig = vp.Fig(bgcolor='white', size=(2000, 2000), show=False)

    reshape_no = int(np.round(np.power(sampler.no_points, 1 / 3), 3))
    sampler_pressure_field_reshaped = sampler.pressure_field.reshape(
        (reshape_no, reshape_no, reshape_no))

    vol_data_after = np.abs(sampler_pressure_field_reshaped)
    vol_data_after = np.flipud(np.rollaxis(vol_data_after, 1))
    vol_data_after[vol_data_after < threshold] = 0
    vol_pw_after = fig[0, 0]
    vol_pw_after.volume(vol_data_after, cmap=colour_map)
    vol_pw_after.camera = scene.cameras.TurntableCamera(fov=45)

    fig.show(run=True)
コード例 #10
0
ファイル: main.py プロジェクト: pavtiger/physarumRenaissance
def drawOutput(organism):
    fname1 = 'teapot.obj'
    fname2 = 'sphere.obj'
    fig = plot.Fig(title=TITLE)
    fig[0, 0].mesh(*io.read_mesh(fname1)[:2])
        
    arr = io.read_mesh(fname2)[:2]
    for dot in organism:
        a = arr
        for elem in a[0]:
            elem[0] = elem[0] * 1 + dot[0]
            elem[1] = elem[1] * 1 + dot[1]
            elem[2] = elem[2] * 1 + dot[2]
        #print('workin')
    fig[0, 0].mesh(*arr, color=(1, 1, 0.1))
    
    vispy.
            
    app.run()
コード例 #11
0
def test_plot_widget_axes():
    """Test that the axes domains are updated correctly when a figure is first drawn"""
    fig = vp.Fig(size=(800, 800), show=False)
    point = (0, 100)
    fig[0, 0].plot((point, point))
    # mocking the AxisVisual domain.setter
    domain_setter = mock.Mock(wraps=AxisVisual.domain.fset)
    mock_property = AxisVisual.domain.setter(domain_setter)

    with mock.patch.object(AxisVisual, "domain", mock_property):
        # note: fig.show() must be called for this test to work... otherwise
        # Grid._update_child_widget_dim is not triggered and the axes aren't updated
        fig.show(run=False)
        # currently, the AxisWidget adds a buffer of 5% of the
        # full range to either end of the axis domain
        buffer = (point[1] - point[0]) * 0.05
        expectation = [point[0] - buffer, point[1] + buffer]
        for call in domain_setter.call_args_list:
            assert [round(x, 2) for x in call[0][1]] == expectation
コード例 #12
0
	def initUI(self):
		# vispy
		data = np.random.rand(100, 2) # random data
		fig = vp.Fig(size=(800, 600))
		line1 = fig[0, 0].plot(data=data)
		line2 = fig[1, 0].plot(data=data)

		# PyQt (with vispy fig.native)
		self.myHBoxLayout = QtWidgets.QHBoxLayout(self)
		self.myHBoxLayout.addWidget(QtWidgets.QPushButton('My Button'))
		self.myHBoxLayout.addWidget(fig.native)

		self.show()

		# update line1 plot with new data offset by 100
		newData = np.random.rand(100, 2) + 100
		# this call to set_data does not update the range of x/y axis
		# If I zoom out with mouse-wheel I can verify it is plotted
		line1.set_data(newData)

		# Is there something I can add here ???
		line1.update()
コード例 #13
0
ファイル: visualise.py プロジェクト: ultraleap/HandyBeam
def visualise_3D(world=None,
                 sampler=None,
                 threshold=50,
                 colour_map='cubehelix'):
    """  show a 3D volume visualisation using VisPy

    :param world : handybeam.world.World
         the world from which to take the data

    :param sampler: handybeam.samplers.abstract_sampler
         the sampler from which to take the data

    :param threshold:
         threshold of visibility for volume visualisation

    :param colour_map:
         colour map for volume visualisation

    :return:
        creates the figure, and shows it.

    """

    fig = vp.Fig(bgcolor='white', size=(2000, 2000), show=False)

    reshape_no = int(np.round(np.power(sampler.no_points, 1 / 3), 3))
    sampler_pressure_field_reshaped = sampler.pressure_field.reshape(
        (reshape_no, reshape_no, reshape_no))

    vol_data_after = np.abs(sampler_pressure_field_reshaped)
    vol_data_after = np.flipud(np.rollaxis(vol_data_after, 1))
    vol_data_after[vol_data_after < threshold] = 0
    vol_pw_after = fig[0, 0]
    vol_pw_after.volume(vol_data_after, cmap=colour_map)
    vol_pw_after.camera = scene.cameras.TurntableCamera(fov=45)

    fig.show(run=True)
コード例 #14
0
ファイル: colorbar.py プロジェクト: djhoese/vispy
    z = np.complex(x, y)
    f = np.exp(1.0 / z)
    return np.angle(f, deg=True)


# create a 2d grid whose elements are of exp_z_inv
def gen_image(width, height):
    x_vals = np.linspace(-0.5, 0.5, width)
    y_vals = np.linspace(-0.5, 0.5, height)

    grid = np.meshgrid(x_vals, y_vals)
    v_fn = np.vectorize(exp_z_inv)

    return v_fn(*grid).astype(np.float32)

fig = vp.Fig(size=(800, 600), show=False)
plot = fig[0, 0]
plot.bgcolor = "#efefef"

img = gen_image(500, 500)
plot.image(img, cmap="hsl")
plot.camera.set_range((100, 400), (100, 400))

positions = ["top", "bottom", "left", "right"]

for position in positions:
    plot.colorbar(position=position,
                  label="argument of e^(1/z)",
                  clim=("0°", "180°"),
                  cmap="hsl",
                  border_width=1,
コード例 #15
0
np.random.seed(2324)
n = 100000
data = np.empty((n, 2))
lasti = 0
for i in range(1, 20):
    nexti = lasti + (n - lasti) // 2
    scale = np.abs(np.random.randn(2)) + 0.1
    scale[1] = scale.mean()
    data[lasti:nexti] = np.random.normal(size=(nexti - lasti, 2),
                                         loc=np.random.randn(2),
                                         scale=scale / i)
    lasti = nexti
data = data[:lasti]

color = (0.3, 0.5, 0.8)
n_bins = 100

fig = vp.Fig(show=False)
line = fig[0:4, 0:4].plot(data,
                          symbol='o',
                          width=0,
                          face_color=color + (0.02, ),
                          edge_color=None,
                          marker_size=4)
line.set_gl_state(depth_test=False)
fig[4, 0:4].histogram(data[:, 0], bins=n_bins, color=color, orientation='h')
fig[0:4, 4].histogram(data[:, 1], bins=n_bins, color=color, orientation='v')

if __name__ == '__main__':
    fig.show(run=True)
コード例 #16
0
def main(argv):
    START = 0
    STOP = 64
    STEP = 2

    # colors for plotting
    colz = [
        "#C900E5", "#C603E1", "#C306DD", "#C009DA", "#BD0CD6", "#BA0FD2",
        "#B812CF", "#B515CB", "#B218C7", "#AF1BC4", "#AC1EC0", "#A921BD",
        "#A724B9", "#A427B5", "#A12AB2", "#9E2DAE", "#9B30AA", "#9833A7",
        "#9636A3", "#93399F", "#903C9C", "#8D3F98", "#8A4295", "#884591",
        "#85488D", "#824B8A", "#7F4E86", "#7C5182", "#79547F", "#77577B",
        "#745A77", "#715D74", "#6E6170", "#6B646D", "#686769", "#666A65",
        "#636D62", "#60705E", "#5D735A", "#5A7657", "#577953", "#557C4F",
        "#527F4C", "#4F8248", "#4C8545", "#498841", "#478B3D", "#448E3A",
        "#419136", "#3E9432", "#3B972F", "#389A2B", "#369D27", "#33A024",
        "#30A320", "#2DA61D", "#2AA919", "#27AC15", "#25AF12", "#22B20E",
        "#1FB50A", "#1CB807", "#19BB03", "#17BF00"
    ]

    # go through list of arguments and check for existing files and dirs
    files = arg2files(argv)

    # open filedialog for files
    if len(argv) == 0:
        Tk().withdraw()
        files = filedialog.askopenfilenames(title='Choose file/s to load')

    fs = 100.
    N = 360000
    t = np.arange(N) / float(fs)
    figs = []

    for ind, _file in enumerate(files):
        print(_file)
        figs.append(vp.Fig(size=(1600, 1000), show=False))
        fig = figs[-1]
        plt_even = fig[0, 0]
        plt_odd = fig[1, 0]
        plt_even._configure_2d()
        plt_odd._configure_2d()
        plt_even.xlabel.text = 'Time (s)'
        plt_odd.xlabel.text = 'Time (s)'
        plt_even.title.text = os.path.basename(_file) + " even CH"
        plt_odd.title.text = os.path.basename(_file) + " odd CH"
        this_data = get_data(_file)
        if N > get_data_len(_file):
            N = get_data_len(_file)
            t = np.arange(N) / float(fs)
        print(this_data.shape)
        diff_data = np.zeros(t.shape)
        sum_signal = np.zeros(t.shape)
        thr = 200
        for ch in range(START, STOP, STEP):
            if ch % 16 == 0:
                print(ch)
            """ This one does the magic """
            KSIZE = 21  ##501
            filtered_signal = sg.medfilt(this_data[ch + 1], kernel_size=KSIZE)
            filtered_signal = np.abs(
                filtered_signal -
                filtered_signal[0])  # positive changes from baseline
            thr_signal = filtered_signal > thr
            sum_signal += thr_signal

            #plt_even.plot(np.array((t, filtered_signal)).T, marker_size=0, color=colz[ch])
            plt_even.plot(np.array((t, this_data[ch] + 1000 * ch)).T,
                          marker_size=0,
                          color=colz[ch])
            #plt_even.plot(np.array((t[thr_signal==1], 1000*thr_signal[thr_signal==1])).T, marker_size=0, color='r')
            #plt_odd.plot(np.array((t, this_data[ch+1]+1000*ch)).T, marker_size=0, color=colz[ch])
            #plt_odd.spectrogram(this_data[ch], fs=fs)
            #plt_odd.plot(np.array((t, filtered_signal)).T, marker_size=0, color=colz[ch])
            plt_odd.plot(np.array((t, this_data[ch + 1] + 1000 * ch)).T,
                         marker_size=0,
                         color=colz[ch])
        ch_thr = 24
        thr_sum_signal = sum_signal > ch_thr

        if np.count_nonzero(thr_sum_signal) > 0:
            print(np.count_nonzero(thr_sum_signal),
                  consecutive_one(thr_sum_signal))
            if (consecutive_one(thr_sum_signal) > 500):
                print("Noise detected at",
                      (np.nonzero(thr_sum_signal)[0])[0] / fs, "secs")
            else:
                print("No noise detected.")
        else:
            print("No noise detected.")

        #plt_even.plot(np.array((t, (1000/32)*sum_signal)).T, marker_size=0, width=1, color='b')
        plt_even.plot(np.array((t, (1000) * thr_sum_signal - 1000)).T,
                      marker_size=0,
                      width=2,
                      color='r')
        plt_odd.plot(np.array((t, (1000) * thr_sum_signal - 1000)).T,
                     marker_size=0,
                     width=2,
                     color='r')
    for fig in figs:
        fig.show(run=True)
    # if no files are given
    if len(files) == 0:
        print("WARNING: No valid files specified.")
コード例 #17
0
ファイル: plot_colorbars.py プロジェクト: zymspindrift/vispy
# -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
Show use of colorbars in plot
"""
import vispy.plot as vp

fig = vp.Fig(size=(600, 500), show=False)
plotwidget = fig[0, 0]

fig.title = "bollu"
plotwidget.plot([(x, x**2) for x in range(0, 100)], title="y = x^2")
plotwidget.colorbar(position="top", cmap="autumn")

if __name__ == '__main__':
    fig.show(run=True)
コード例 #18
0
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# vispy: gallery 1
"""
Plot various views of a structural MRI.
"""

import numpy as np

from vispy import io, plot as vp

fig = vp.Fig(bgcolor='k', size=(800, 800), show=False)

vol_data = np.load(io.load_data_file('brain/mri.npz'))['data']
vol_data = np.flipud(np.rollaxis(vol_data, 1))

clim = [32, 192]
vol_pw = fig[0, 0]
vol_pw.volume(vol_data, clim=clim)
vol_pw.view.camera.elevation = 30
vol_pw.view.camera.azimuth = 30
vol_pw.view.camera.scale_factor /= 1.5

shape = vol_data.shape
fig[1, 0].image(vol_data[:, :, shape[2] // 2],
                cmap='grays',
                clim=clim,
                fg_color=(0.5, 0.5, 0.5, 1))
fig[0, 1].image(vol_data[:, shape[1] // 2, :],
                cmap='grays',
コード例 #19
0
ファイル: picking.py プロジェクト: djhoese/vispy
import numpy as np
import vispy.plot as vp
from vispy.color import get_colormap

# load example data
from vispy.io import load_data_file
data = np.load(load_data_file('electrophys/iv_curve.npz'))['arr_0']
data *= 1000  # V -> mV
dt = 1e-4  # this data is sampled at 10 kHz

# create figure with plot
fig = vp.Fig()
plt = fig[0, 0]
plt._configure_2d()
plt.title.text = 'Current Clamp Recording'
plt.ylabel.text = 'Membrane Potential (mV)'
plt.xlabel.text = 'Time (ms)'
selected = None

# plot data
cmap = get_colormap('hsl', value=0.5)
colors = cmap.map(np.linspace(0.1, 0.9, data.shape[0]))
t = np.arange(data.shape[1]) * (dt * 1000)
for i, y in enumerate(data):
    line = plt.plot((t, y), color=colors[i])
    line.interactive = True
    line.unfreeze()  # make it so we can add a new property to the instance
    line.data_index = i
    line.freeze()

コード例 #20
0
"""
fragment = """
void main() {
    gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
}
"""

program = gloo.Program(vertex, fragment)

program['a_position'] = np.c_[
    np.random.uniform(-0.5, +0.5, 1000).astype(np.float32),
    np.random.uniform(-0.5, +0.5, 1000).astype(np.float32)]
''''''
fname1 = 'teapot.obj'
fname2 = 'sphere.obj'
fig = plot.Fig()
fig[0, 0].mesh(*io.read_mesh(fname1)[:2])
fig[0, 0].mesh(*io.read_mesh(fname2)[:2])
''''''


@c.connect
def on_resize(event):
    gloo.set_viewport(0, 0, *event.size)


@c.connect
def on_draw(event):
    gloo.clear((0, 0, 0, 1))
    program.draw('points')
コード例 #21
0
ファイル: export.py プロジェクト: zymspindrift/vispy
# -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
Demonstrates rendering a canvas to an image at higher resolution than the
original display.
"""

import vispy.plot as vp

# Create a canvas showing plot data
fig = vp.Fig()
fig[0, 0].plot([1, 6, 2, 4, 3, 8, 5, 7, 6, 3])

# Render the canvas scene to a numpy array image with higher resolution
# than the original canvas
scale = 4
image = fig.render(size=(fig.size[0] * scale, fig.size[1] * scale))

# Display the data in the array, sub-sampled down to the original canvas
# resolution
fig_2 = vp.Fig()
fig_2[0, 0].image(image[::-scale, ::scale])

# By default, the view adds some padding when setting its range.
# We'll remove that padding so the image looks exactly like the original
# canvas:
fig_2[0, 0].camera.set_range(margin=0)

if __name__ == '__main__':
    fig.app.run()
コード例 #22
0
import numpy as np
import vispy.plot as vplt

fname = '../data/seismic_volume.npy'
data = np.load(fname)
fig = vplt.Fig()
scene = fig[0, 0]
scene.volume(data)
fig.show(run=True)
コード例 #23
0
    def __init__(self, parent=None, name=None):
        super(VispyCanvas, self).__init__(parent=parent)
        self.parent = parent
        self.main = self.parent.parent.parent.main
        self.treebase = self.main.treebase
        self.database = self.main.database
        self.dpState = {}
        self.opts = None
        self.hasState = False
        self._name = name

        self.canvas = vpp.Fig(show=False)
        self.canvas00 = self.canvas[0, 0]
        self.canvas.unfreeze()
        self.canvas.visuals = []
        self.canvas.pick_mode = False
        self.canvas.sigPickedPoint = self.sigPickedPoint
        self.canvas.freeze()
        self.toggle_pick_mode(False)
        self.sigPickedPoint.connect(self.print_coord)

        vbox = QVBoxLayout()
        vbox.addWidget(self.canvas.native)
        self.setLayout(vbox)

        @self.canvas.connect
        def on_mouse_press(event):
            if not self.canvas.pick_mode:
                return
            if len(self.canvas.visuals) == 0:
                return  # canvas is empty

            #if event.handled or event.button != 1:
            #    return
            if event.button == 2:
                queried = None
                for v in self.canvas.visuals_at(event.pos):
                    if isinstance(v, vp.scene.widgets.viewbox.ViewBox):
                        continue
                    queried = v
                    break
                if queried is not None:
                    logger.info("Object name {}".format(queried.name))
                return

            # emit signal of coordinate of picked point
            vis = self.canvas.visuals[0]
            tr = self.canvas.scene.node_transform(vis)
            pos = tr.map(event.pos)
            x, y, z = pos[:3]
            xy = np.array([x, y])
            survey = self.treebase.survey
            if survey is None:
                ilno, xlno = (0, 0)
            else:
                ilno, xlno = xy2ln(xy, survey=survey)
            self.canvas.sigPickedPoint.emit((ilno, xlno, x, y, z))

            selected = None
            for v in self.canvas.visuals_at(event.pos):
                if isinstance(v, vp.scene.widgets.viewbox.ViewBox):
                    continue
                selected = v
                break
            if selected is not None:
                display_selection(self.canvas, selected, event.pos)
コード例 #24
0
ファイル: plot.py プロジェクト: MatteoLacki/vispywrapper
def get_figure(size=(800, 400), show=False):
    return vp.Fig(size=size, show=False)
コード例 #25
0
#!/usr/bin/env ipython -i ipython_fig_playground.py
# -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
Bare bones plotting region that can be used with the python
interpreter as a playground.

Run with
python -i ipython_fig_playground.py
"""
from vispy import plot as vp  # noqa
import numpy as np  # noqa

fig = vp.Fig(size=(600, 500))  # noqa
plotwidget = fig[0, 0]