-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy path_plot.py
More file actions
68 lines (53 loc) · 1.84 KB
/
_plot.py
File metadata and controls
68 lines (53 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from typing import *
import pygfx
from wgpu.gui.auto import WgpuCanvas
from ._subplot import Subplot
from ._frame import Frame
from ._record_mixin import RecordMixin
class Plot(Subplot, Frame, RecordMixin):
def __init__(
self,
canvas: Union[str, WgpuCanvas] = None,
renderer: pygfx.WgpuRenderer = None,
camera: Union[str, pygfx.PerspectiveCamera] = "2d",
controller: Union[str, pygfx.Controller] = None,
size: Tuple[int, int] = (500, 300),
**kwargs,
):
"""
Simple Plot object.
Parameters
----------
canvas: WgpuCanvas, optional
Canvas for drawing
renderer: pygfx.Renderer, optional
pygfx renderer instance
camera: str or pygfx.PerspectiveCamera, optional
| One of ``"2d"`` or ``"3d"`` indicating 2D or 3D camera
controller: str or pygfx.Controller, optional
Usually ``None``, you can pass an existing controller from another
``Plot`` or ``Subplot`` to synchronize them.
You can also pass str arguments of valid controller names, see Subplot docstring for valid names
size: (int, int)
starting size of canvas, default (500, 300)
kwargs
passed to Subplot, for example ``name``
"""
super().__init__(
parent=None,
position=(0, 0),
parent_dims=(1, 1),
canvas=canvas,
renderer=renderer,
camera=camera,
controller=controller,
**kwargs,
)
RecordMixin.__init__(self)
Frame.__init__(self)
self._starting_size = size
def render(self):
"""performs a single render of the plot, not for the user"""
super().render()
self.renderer.flush()
self.canvas.request_draw()