Collection
DragPointCollection
A collection of DragPoints used to implement complex interactive functions. All collections of DragPoints must inherit from DragPointCollection and implement the following methods:
- function:
f(x, *args)
that returns a float. - update: updates
DragPointCollection.poly
withDragPointCollection.dragpoints
positions. - get_args: returns arguments needed for function (
*args
). Must be derived fromDragPointCollection.dragpoints
positions.
Source code in itfit/utils/collection.py
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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
__init__(dragpoints, blit_manager, *, linestyle='-', color='red')
Collection of DragPoints. Used to implement more complicated DragObjects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dragpoints |
list[DragPoint]
|
collection vertices. |
required |
blit_manager |
BlitManager
|
used for automtic ploting. |
required |
Source code in itfit/utils/collection.py
get_xdata()
Gets xdata from DragPoints in data coordinates.
Returns:
Type | Description |
---|---|
Tuple[float]
|
x in data coordinates. |
get_xdata_display()
Gets xdata from DragPoints in display coordinates.
Returns:
Type | Description |
---|---|
Tuple[float]
|
x in display coordinates. |
get_xy(*args)
Applies and returns correct transformation from display to data coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args |
List[float, float] | List[List[float, float], ...]
|
Coordinates from display. |
()
|
Returns:
Type | Description |
---|---|
Tuple[float, float] | Tuple[Tuple[float, float], ...]
|
Coordinates from data. |
Source code in itfit/utils/collection.py
get_ydata()
Gets ydata from DragPoints in data coordinates.
Returns:
Type | Description |
---|---|
Tuple[float]
|
y in data coordinates. |
get_ydata_display()
Gets ydata from DragPoints in display coordinates.
Returns:
Type | Description |
---|---|
Tuple[float]
|
y in display coordinates. |
remove()
set_xy(*args)
Applies and returns correct transformation from data coordinates to display.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args |
List[float] | List[List[float, float]]
|
Coordinates from data. |
()
|
Returns:
Type | Description |
---|---|
Tuple[float] | Tuple[Tuple[float, float]]
|
Coordinates from display. |