Point
DragPoint
Data containter for draggable points. In the future it may support form, size and colour change.
Source code in itfit/utils/point.py
__init__(x, y, style, *args, **kwargs)
Creates a patch in given display coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
float
|
y position in display units (between 0 and 1). |
required |
y |
float
|
y position in display units (between 0 and 1). |
required |
style |
Any No used. |
required |
Source code in itfit/utils/point.py
get_center()
Returns the center position in display coordinates.
Returns:
Type | Description |
---|---|
Tuple[float, float]
|
Center in display coordinates. |
DragPointManager
Manages DragPoints
: event connection, automatic replotting on change/update, blitting and restrictions.
Source code in itfit/utils/point.py
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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
|
__init__(dragpoint, blit_manager)
Manages a DragPoint's BlitManager connection, callbacks on matplotlib events and automatic drawing.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dragpoint |
DragPoint
|
contains patch. |
required |
blit_manager |
BlitManager
|
used for automtic ploting. |
required |
Source code in itfit/utils/point.py
add_restriction(function)
Adds a restriction to point movement.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
function |
callable
|
Must have signature |
required |
Source code in itfit/utils/point.py
connect(function)
Connects a callback for change envents.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
function |
callable
|
Function to be executed when the DragPoint updates. Must have signature |
required |
Returns:
Type | Description |
---|---|
Int
|
Connection id. Can be used in |
Source code in itfit/utils/point.py
disconnect(cid)
Disconnects the callback with given cid
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cid |
Int
|
Connection id. |
required |
get_xy(x, y)
Applies correct transformation from display to data coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
float
|
x in display coordinates. |
required |
y |
float
|
y in display coordinates. |
required |
Returns:
Type | Description |
---|---|
Tuple[float, float]
|
x and y in data coordinates. |
Source code in itfit/utils/point.py
on_button_press(event)
Callback for mouse button presses
Source code in itfit/utils/point.py
on_button_release(event)
Callback for mouse button releases
on_key_press(event)
on_mouse_move(event)
Callback for mouse movements
Source code in itfit/utils/point.py
remove_restriction()
set_xy(x, y)
Applies correct transformation from data coordinates to display
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
float
|
x in data coordinates. |
required |
y |
float
|
y in data coordinates. |
required |
Returns:
Type | Description |
---|---|
Tuple[float, float]
|
x and y in display coordinates. |