interactive-figure 0.3.6__py3-none-any.whl → 0.4.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- interactive_figure/__about__.py +1 -1
- interactive_figure/interactive_figure.py +18 -23
- {interactive_figure-0.3.6.dist-info → interactive_figure-0.4.1.dist-info}/METADATA +1 -1
- interactive_figure-0.4.1.dist-info/RECORD +7 -0
- interactive_figure-0.3.6.dist-info/RECORD +0 -7
- {interactive_figure-0.3.6.dist-info → interactive_figure-0.4.1.dist-info}/WHEEL +0 -0
- {interactive_figure-0.3.6.dist-info → interactive_figure-0.4.1.dist-info}/licenses/LICENSE.txt +0 -0
interactive_figure/__about__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.
|
|
1
|
+
__version__ = "0.4.1"
|
|
@@ -10,17 +10,17 @@ from types import SimpleNamespace
|
|
|
10
10
|
import sys
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def create(
|
|
13
|
+
def create(hide_labels=False, hide_toolbar=False, **kwargs):
|
|
14
14
|
"""Create the interactive figure.
|
|
15
15
|
|
|
16
16
|
Parameters
|
|
17
17
|
----------
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
hide_labels : bool, optional
|
|
19
|
+
remove all labels from the figure (makes rendering *much* faster).
|
|
20
20
|
hide_toolbar : bool, optional
|
|
21
21
|
whether to hide the toolbar, default False.
|
|
22
22
|
|
|
23
|
-
Remaining arguments will be sent to the figure upon creation.
|
|
23
|
+
Remaining keyword arguments will be sent to the figure upon creation.
|
|
24
24
|
|
|
25
25
|
Raises
|
|
26
26
|
----------
|
|
@@ -31,6 +31,9 @@ def create(aspect_ratio="auto", hide_toolbar=False, **kwargs):
|
|
|
31
31
|
if hide_toolbar:
|
|
32
32
|
plt.rcParams["toolbar"] = "None"
|
|
33
33
|
|
|
34
|
+
if hide_labels:
|
|
35
|
+
_state.hide_labels = True
|
|
36
|
+
|
|
34
37
|
# Disable interactive mode for explicit control over drawing. See:
|
|
35
38
|
# https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.isinteractive.html#matplotlib.pyplot.isinteractive
|
|
36
39
|
plt.ioff()
|
|
@@ -39,7 +42,6 @@ def create(aspect_ratio="auto", hide_toolbar=False, **kwargs):
|
|
|
39
42
|
fig.canvas.manager.set_window_title("Interactive Figure")
|
|
40
43
|
# Create drawable axis.
|
|
41
44
|
_state.ax = ax = plt.gca()
|
|
42
|
-
ax.set_aspect(aspect_ratio)
|
|
43
45
|
|
|
44
46
|
# Show figure but allow the main thread to continue.
|
|
45
47
|
plt.show(block=False)
|
|
@@ -62,7 +64,7 @@ def create(aspect_ratio="auto", hide_toolbar=False, **kwargs):
|
|
|
62
64
|
|
|
63
65
|
print("Interactive figure: created")
|
|
64
66
|
else:
|
|
65
|
-
raise RuntimeError("
|
|
67
|
+
raise RuntimeError("Interactive figure: ERROR - you cannot create multiple figures")
|
|
66
68
|
|
|
67
69
|
|
|
68
70
|
def draw():
|
|
@@ -77,26 +79,17 @@ def draw():
|
|
|
77
79
|
canvas.flush_events()
|
|
78
80
|
|
|
79
81
|
|
|
80
|
-
def clear(
|
|
81
|
-
"""Reset contents and layout of the figure.
|
|
82
|
-
|
|
83
|
-
Parameters
|
|
84
|
-
----------
|
|
85
|
-
set_limits : bool, optional
|
|
86
|
-
set the Axes limits to [0, 100].
|
|
87
|
-
hide_labels : bool, optional
|
|
88
|
-
remove all labels from the figure.
|
|
89
|
-
"""
|
|
82
|
+
def clear():
|
|
83
|
+
"""Reset contents and layout of the figure."""
|
|
90
84
|
_check_exists()
|
|
91
85
|
|
|
92
86
|
ax = _state.ax
|
|
93
87
|
ax.clear()
|
|
94
88
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
ax.set_ylim([0, 100])
|
|
89
|
+
ax.set_xlim([0, 100])
|
|
90
|
+
ax.set_ylim([0, 100])
|
|
98
91
|
|
|
99
|
-
if hide_labels:
|
|
92
|
+
if _state.hide_labels:
|
|
100
93
|
ax.set_xticks([])
|
|
101
94
|
ax.set_yticks([])
|
|
102
95
|
|
|
@@ -105,7 +98,7 @@ def toggle_fullscreen():
|
|
|
105
98
|
"""Toggle fullscreen."""
|
|
106
99
|
_check_exists()
|
|
107
100
|
|
|
108
|
-
_state.
|
|
101
|
+
_state.fig.canvas.manager.full_screen_toggle()
|
|
109
102
|
|
|
110
103
|
|
|
111
104
|
def close():
|
|
@@ -264,13 +257,14 @@ def _check_exists():
|
|
|
264
257
|
If the figure is not available
|
|
265
258
|
"""
|
|
266
259
|
if _state.fig is None:
|
|
267
|
-
raise RuntimeError("
|
|
260
|
+
raise RuntimeError("Interactive figure: ERROR - figure is not available")
|
|
268
261
|
|
|
269
262
|
|
|
270
263
|
def _state_reset_fig():
|
|
271
264
|
"""Reset figure information."""
|
|
272
265
|
_state.fig = None
|
|
273
266
|
_state.ax = None
|
|
267
|
+
_state.hide_labels = False
|
|
274
268
|
_state.closed_using_ui = True
|
|
275
269
|
|
|
276
270
|
|
|
@@ -331,9 +325,10 @@ def _close_handler(event):
|
|
|
331
325
|
_state = SimpleNamespace(
|
|
332
326
|
fig=None,
|
|
333
327
|
ax=None,
|
|
328
|
+
hide_labels=False,
|
|
329
|
+
closed_using_ui=True,
|
|
334
330
|
last_keypress=None,
|
|
335
331
|
last_mousepress=None,
|
|
336
332
|
last_mouse_x=None,
|
|
337
333
|
last_mouse_y=None,
|
|
338
|
-
closed_using_ui=True
|
|
339
334
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: interactive-figure
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: Create interactive Matplotlib figures!
|
|
5
5
|
Project-URL: Documentation, https://teuncm.github.io/interactive-figure/autoapi/interactive_figure/interactive_figure/index.html
|
|
6
6
|
Project-URL: Issues, https://github.com/teuncm/interactive-figure/issues
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interactive_figure/__about__.py,sha256=075iz_wmJWFZOiHbuinNMyz1WJHo7tp0N817twjxQkQ,23
|
|
2
|
+
interactive_figure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
interactive_figure/interactive_figure.py,sha256=F2y1wknsSAR5lBWNWMFtpMlvIr2ctvtrttG_ECrfP7Y,8908
|
|
4
|
+
interactive_figure-0.4.1.dist-info/METADATA,sha256=khsIQNKkrjYktPB5InXW-55a0NX3_6Vj1ytBEbVLHcs,2438
|
|
5
|
+
interactive_figure-0.4.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
6
|
+
interactive_figure-0.4.1.dist-info/licenses/LICENSE.txt,sha256=R6IpPdPKA5nLHPKRXIhlFHLE59dMUtve0qeXhZPr0Hk,1043
|
|
7
|
+
interactive_figure-0.4.1.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
interactive_figure/__about__.py,sha256=rshQ1apZMMdkI5bameILs0GVFulDBuEpfDswTVoETqk,23
|
|
2
|
-
interactive_figure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
interactive_figure/interactive_figure.py,sha256=1vAsDyZj4D5Prdp8HXtx8JCa7Q-3mzkiaLXZo1gbCwE,9047
|
|
4
|
-
interactive_figure-0.3.6.dist-info/METADATA,sha256=aprlOHFNqf1hSv7VSMt1-9Z1h-_CdNfhNpnV0VXr0kw,2438
|
|
5
|
-
interactive_figure-0.3.6.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
6
|
-
interactive_figure-0.3.6.dist-info/licenses/LICENSE.txt,sha256=R6IpPdPKA5nLHPKRXIhlFHLE59dMUtve0qeXhZPr0Hk,1043
|
|
7
|
-
interactive_figure-0.3.6.dist-info/RECORD,,
|
|
File without changes
|
{interactive_figure-0.3.6.dist-info → interactive_figure-0.4.1.dist-info}/licenses/LICENSE.txt
RENAMED
|
File without changes
|