interactive-figure 0.3.4__tar.gz → 0.3.6__tar.gz

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.
Files changed (102) hide show
  1. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/PKG-INFO +4 -1
  2. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/README.md +3 -0
  3. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/.doctrees/autoapi/interactive_figure/interactive_figure/index.doctree +0 -0
  4. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/.doctrees/environment.pickle +0 -0
  5. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_sources/autoapi/interactive_figure/interactive_figure/index.rst.txt +15 -11
  6. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/autoapi/interactive_figure/interactive_figure/index.html +26 -19
  7. interactive_figure-0.3.6/docs/searchindex.js +1 -0
  8. interactive_figure-0.3.6/src/interactive_figure/__about__.py +1 -0
  9. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/src/interactive_figure/interactive_figure.py +46 -19
  10. interactive_figure-0.3.4/docs/searchindex.js +0 -1
  11. interactive_figure-0.3.4/src/interactive_figure/__about__.py +0 -1
  12. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/.gitignore +0 -0
  13. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/LICENSE.txt +0 -0
  14. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/demo/press.py +0 -0
  15. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/demo/reaction_time.py +0 -0
  16. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/demo/usage.py +0 -0
  17. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/.buildinfo +0 -0
  18. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/.buildinfo.bak +0 -0
  19. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/.doctrees/autoapi/index.doctree +0 -0
  20. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/.doctrees/autoapi/interactive_figure/__about__/index.doctree +0 -0
  21. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/.doctrees/autoapi/interactive_figure/index.doctree +0 -0
  22. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/.doctrees/index.doctree +0 -0
  23. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/.nojekyll +0 -0
  24. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_sources/autoapi/index.rst.txt +0 -0
  25. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_sources/autoapi/interactive_figure/__about__/index.rst.txt +0 -0
  26. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_sources/autoapi/interactive_figure/index.rst.txt +0 -0
  27. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_sources/index.rst.txt +0 -0
  28. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/_sphinx_javascript_frameworks_compat.js +0 -0
  29. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/basic.css +0 -0
  30. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/badge_only.css +0 -0
  31. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/Roboto-Slab-Bold.woff +0 -0
  32. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/Roboto-Slab-Bold.woff2 +0 -0
  33. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/Roboto-Slab-Regular.woff +0 -0
  34. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/Roboto-Slab-Regular.woff2 +0 -0
  35. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/fontawesome-webfont.eot +0 -0
  36. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/fontawesome-webfont.svg +0 -0
  37. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/fontawesome-webfont.ttf +0 -0
  38. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/fontawesome-webfont.woff +0 -0
  39. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/fontawesome-webfont.woff2 +0 -0
  40. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/lato-bold-italic.woff +0 -0
  41. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/lato-bold-italic.woff2 +0 -0
  42. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/lato-bold.woff +0 -0
  43. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/lato-bold.woff2 +0 -0
  44. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/lato-normal-italic.woff +0 -0
  45. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/lato-normal-italic.woff2 +0 -0
  46. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/lato-normal.woff +0 -0
  47. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/fonts/lato-normal.woff2 +0 -0
  48. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/css/theme.css +0 -0
  49. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/doctools.js +0 -0
  50. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/documentation_options.js +0 -0
  51. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/file.png +0 -0
  52. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/Lato/lato-bold.eot +0 -0
  53. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/Lato/lato-bold.ttf +0 -0
  54. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/Lato/lato-bold.woff +0 -0
  55. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/Lato/lato-bold.woff2 +0 -0
  56. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/Lato/lato-bolditalic.eot +0 -0
  57. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/Lato/lato-bolditalic.ttf +0 -0
  58. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/Lato/lato-bolditalic.woff +0 -0
  59. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/Lato/lato-bolditalic.woff2 +0 -0
  60. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/Lato/lato-italic.eot +0 -0
  61. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/Lato/lato-italic.ttf +0 -0
  62. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/Lato/lato-italic.woff +0 -0
  63. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/Lato/lato-italic.woff2 +0 -0
  64. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/Lato/lato-regular.eot +0 -0
  65. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/Lato/lato-regular.ttf +0 -0
  66. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/Lato/lato-regular.woff +0 -0
  67. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/Lato/lato-regular.woff2 +0 -0
  68. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot +0 -0
  69. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf +0 -0
  70. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff +0 -0
  71. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 +0 -0
  72. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot +0 -0
  73. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf +0 -0
  74. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff +0 -0
  75. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 +0 -0
  76. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/graphviz.css +0 -0
  77. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/jquery.js +0 -0
  78. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/js/badge_only.js +0 -0
  79. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/js/html5shiv-printshiv.min.js +0 -0
  80. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/js/html5shiv.min.js +0 -0
  81. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/js/theme.js +0 -0
  82. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/js/versions.js +0 -0
  83. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/language_data.js +0 -0
  84. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/minus.png +0 -0
  85. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/plus.png +0 -0
  86. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/pygments.css +0 -0
  87. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/searchtools.js +0 -0
  88. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/_static/sphinx_highlight.js +0 -0
  89. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/autoapi/index.html +0 -0
  90. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/autoapi/interactive_figure/__about__/index.html +0 -0
  91. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/autoapi/interactive_figure/index.html +0 -0
  92. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/genindex.html +0 -0
  93. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/index.html +0 -0
  94. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/objects.inv +0 -0
  95. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/py-modindex.html +0 -0
  96. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs/search.html +0 -0
  97. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs_source/conf.py +0 -0
  98. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/docs_source/index.rst +0 -0
  99. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/generate_docs.sh +0 -0
  100. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/pyproject.toml +0 -0
  101. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/src/interactive_figure/__init__.py +0 -0
  102. {interactive_figure-0.3.4 → interactive_figure-0.3.6}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: interactive-figure
3
- Version: 0.3.4
3
+ Version: 0.3.6
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
@@ -63,6 +63,9 @@ hatch shell
63
63
  hatch version fix
64
64
  hatch build -c
65
65
  ./generate_docs.sh
66
+
67
+ # Publish
68
+ hatch publish
66
69
  ```
67
70
 
68
71
  ## Links
@@ -43,6 +43,9 @@ hatch shell
43
43
  hatch version fix
44
44
  hatch build -c
45
45
  ./generate_docs.sh
46
+
47
+ # Publish
48
+ hatch publish
46
49
  ```
47
50
 
48
51
  ## Links
@@ -39,14 +39,14 @@ Module Contents
39
39
  Parameters
40
40
  ----------
41
41
  aspect_ratio : str, optional
42
- aspect ratio of the Axes, by default "auto"
42
+ aspect ratio of the Axes, default "auto".
43
43
  hide_toolbar : bool, optional
44
- whether to hide the toolbar, by default False
44
+ whether to hide the toolbar, default False.
45
45
 
46
- remaining arguments will be sent to the figure upon creation
46
+ Remaining arguments will be sent to the figure upon creation.
47
47
 
48
48
  Raises
49
- ------
49
+ ----------
50
50
  RuntimeError
51
51
  if multiple interactive figures are created.
52
52
 
@@ -58,10 +58,14 @@ Module Contents
58
58
 
59
59
  .. py:function:: clear(hide_labels=False, set_limits=True)
60
60
 
61
- Reset contents and layout of the figure.
61
+ Reset contents and layout of the figure.
62
62
 
63
- *set_limits* will set the Axes limits to
64
- [0, 100]. *hide_labels* will remove all labels.
63
+ Parameters
64
+ ----------
65
+ set_limits : bool, optional
66
+ set the Axes limits to [0, 100].
67
+ hide_labels : bool, optional
68
+ remove all labels from the figure.
65
69
 
66
70
 
67
71
  .. py:function:: toggle_fullscreen()
@@ -100,7 +104,7 @@ Module Contents
100
104
  Returns
101
105
  -------
102
106
  str | None
103
- The last key that was pressed
107
+ The last key that was pressed.
104
108
 
105
109
 
106
110
  .. py:function:: get_last_mouse_press()
@@ -110,7 +114,7 @@ Module Contents
110
114
  Returns
111
115
  -------
112
116
  int | None
113
- The identifier of the last mouse button that was pressed
117
+ The identifier of the last mouse button that was pressed.
114
118
 
115
119
 
116
120
  .. py:function:: get_last_mouse_pos()
@@ -120,7 +124,7 @@ Module Contents
120
124
  Returns
121
125
  -------
122
126
  (x: float, y: float) | (None, None)
123
- The last registered mouse position after any interaction
127
+ The last registered mouse position after any interaction.
124
128
 
125
129
 
126
130
  .. py:function:: wait(timeout)
@@ -133,6 +137,6 @@ Module Contents
133
137
  Parameters
134
138
  ----------
135
139
  timeout : float
136
- Number of seconds to wait for
140
+ Number of seconds to wait for.
137
141
 
138
142
 
@@ -132,12 +132,12 @@ after any input.</p>
132
132
  <section id="parameters">
133
133
  <h3>Parameters<a class="headerlink" href="#parameters" title="Link to this heading"></a></h3>
134
134
  <dl class="simple">
135
- <dt>aspect_ratio<span class="classifier">str, optional</span></dt><dd><p>aspect ratio of the Axes, by default “auto”</p>
135
+ <dt>aspect_ratio<span class="classifier">str, optional</span></dt><dd><p>aspect ratio of the Axes, default “auto”.</p>
136
136
  </dd>
137
- <dt>hide_toolbar<span class="classifier">bool, optional</span></dt><dd><p>whether to hide the toolbar, by default False</p>
137
+ <dt>hide_toolbar<span class="classifier">bool, optional</span></dt><dd><p>whether to hide the toolbar, default False.</p>
138
138
  </dd>
139
139
  </dl>
140
- <p>remaining arguments will be sent to the figure upon creation</p>
140
+ <p>Remaining arguments will be sent to the figure upon creation.</p>
141
141
  </section>
142
142
  <section id="raises">
143
143
  <h3>Raises<a class="headerlink" href="#raises" title="Link to this heading"></a></h3>
@@ -158,8 +158,15 @@ after any input.</p>
158
158
  <dt class="sig sig-object py" id="interactive_figure.interactive_figure.clear">
159
159
  <span class="sig-name descname"><span class="pre">clear</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">hide_labels</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">set_limits</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#interactive_figure.interactive_figure.clear" title="Link to this definition"></a></dt>
160
160
  <dd><p>Reset contents and layout of the figure.</p>
161
- <p><em>set_limits</em> will set the Axes limits to
162
- [0, 100]. <em>hide_labels</em> will remove all labels.</p>
161
+ <section id="id1">
162
+ <h3>Parameters<a class="headerlink" href="#id1" title="Link to this heading"></a></h3>
163
+ <dl class="simple">
164
+ <dt>set_limits<span class="classifier">bool, optional</span></dt><dd><p>set the Axes limits to [0, 100].</p>
165
+ </dd>
166
+ <dt>hide_labels<span class="classifier">bool, optional</span></dt><dd><p>remove all labels from the figure.</p>
167
+ </dd>
168
+ </dl>
169
+ </section>
163
170
  </dd></dl>
164
171
 
165
172
  <dl class="py function">
@@ -179,8 +186,8 @@ after any input.</p>
179
186
  <span class="sig-name descname"><span class="pre">wait_for_interaction</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#interactive_figure.interactive_figure.wait_for_interaction" title="Link to this definition"></a></dt>
180
187
  <dd><p>Wait for interaction.</p>
181
188
  <p>Optionally use a timeout in seconds.</p>
182
- <section id="id1">
183
- <h3>Parameters<a class="headerlink" href="#id1" title="Link to this heading"></a></h3>
189
+ <section id="id2">
190
+ <h3>Parameters<a class="headerlink" href="#id2" title="Link to this heading"></a></h3>
184
191
  <dl class="simple">
185
192
  <dt>timeout<span class="classifier">int, optional</span></dt><dd><p>Timeout in seconds when waiting for input.</p>
186
193
  </dd>
@@ -203,10 +210,10 @@ after any input.</p>
203
210
  <dt class="sig sig-object py" id="interactive_figure.interactive_figure.get_last_key_press">
204
211
  <span class="sig-name descname"><span class="pre">get_last_key_press</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#interactive_figure.interactive_figure.get_last_key_press" title="Link to this definition"></a></dt>
205
212
  <dd><p>Get the last key press in lowercase.</p>
206
- <section id="id2">
207
- <h3>Returns<a class="headerlink" href="#id2" title="Link to this heading"></a></h3>
213
+ <section id="id3">
214
+ <h3>Returns<a class="headerlink" href="#id3" title="Link to this heading"></a></h3>
208
215
  <dl class="simple">
209
- <dt>str | None</dt><dd><p>The last key that was pressed</p>
216
+ <dt>str | None</dt><dd><p>The last key that was pressed.</p>
210
217
  </dd>
211
218
  </dl>
212
219
  </section>
@@ -216,10 +223,10 @@ after any input.</p>
216
223
  <dt class="sig sig-object py" id="interactive_figure.interactive_figure.get_last_mouse_press">
217
224
  <span class="sig-name descname"><span class="pre">get_last_mouse_press</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#interactive_figure.interactive_figure.get_last_mouse_press" title="Link to this definition"></a></dt>
218
225
  <dd><p>Get the ID of the last mouse press.</p>
219
- <section id="id3">
220
- <h3>Returns<a class="headerlink" href="#id3" title="Link to this heading"></a></h3>
226
+ <section id="id4">
227
+ <h3>Returns<a class="headerlink" href="#id4" title="Link to this heading"></a></h3>
221
228
  <dl class="simple">
222
- <dt>int | None</dt><dd><p>The identifier of the last mouse button that was pressed</p>
229
+ <dt>int | None</dt><dd><p>The identifier of the last mouse button that was pressed.</p>
223
230
  </dd>
224
231
  </dl>
225
232
  </section>
@@ -229,10 +236,10 @@ after any input.</p>
229
236
  <dt class="sig sig-object py" id="interactive_figure.interactive_figure.get_last_mouse_pos">
230
237
  <span class="sig-name descname"><span class="pre">get_last_mouse_pos</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#interactive_figure.interactive_figure.get_last_mouse_pos" title="Link to this definition"></a></dt>
231
238
  <dd><p>Get the last mouse position.</p>
232
- <section id="id4">
233
- <h3>Returns<a class="headerlink" href="#id4" title="Link to this heading"></a></h3>
239
+ <section id="id5">
240
+ <h3>Returns<a class="headerlink" href="#id5" title="Link to this heading"></a></h3>
234
241
  <dl class="simple">
235
- <dt>(x: float, y: float) | (None, None)</dt><dd><p>The last registered mouse position after any interaction</p>
242
+ <dt>(x: float, y: float) | (None, None)</dt><dd><p>The last registered mouse position after any interaction.</p>
236
243
  </dd>
237
244
  </dl>
238
245
  </section>
@@ -244,10 +251,10 @@ after any input.</p>
244
251
  <dd><p>Freeze for the given number of seconds.</p>
245
252
  <p>During this period it is not possible to interact
246
253
  with the figure. For sub-second timeouts use time.wait() instead.</p>
247
- <section id="id5">
248
- <h3>Parameters<a class="headerlink" href="#id5" title="Link to this heading"></a></h3>
254
+ <section id="id6">
255
+ <h3>Parameters<a class="headerlink" href="#id6" title="Link to this heading"></a></h3>
249
256
  <dl class="simple">
250
- <dt>timeout<span class="classifier">float</span></dt><dd><p>Number of seconds to wait for</p>
257
+ <dt>timeout<span class="classifier">float</span></dt><dd><p>Number of seconds to wait for.</p>
251
258
  </dd>
252
259
  </dl>
253
260
  </section>
@@ -0,0 +1 @@
1
+ Search.setIndex({"alltitles": {"API Reference": [[0, null]], "Functions": [[2, "functions"]], "Module Contents": [[2, "module-contents"]], "Parameters": [[2, "parameters"], [2, "id1"], [2, "id2"], [2, "id6"]], "Raises": [[2, "raises"]], "Returns": [[2, "returns"], [2, "id3"], [2, "id4"], [2, "id5"]], "Submodules": [[1, "submodules"]], "Welcome to Interactive Figure\u2019s documentation!": [[3, null]], "interactive_figure": [[1, null]], "interactive_figure.interactive_figure": [[2, null]]}, "docnames": ["autoapi/index", "autoapi/interactive_figure/index", "autoapi/interactive_figure/interactive_figure/index", "index"], "envversion": {"sphinx": 64, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2}, "filenames": ["autoapi\\index.rst", "autoapi\\interactive_figure\\index.rst", "autoapi\\interactive_figure\\interactive_figure\\index.rst", "index.rst"], "indexentries": {"clear() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.clear", false]], "close() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.close", false]], "create() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.create", false]], "draw() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.draw", false]], "get_last_key_press() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.get_last_key_press", false]], "get_last_mouse_pos() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.get_last_mouse_pos", false]], "get_last_mouse_press() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.get_last_mouse_press", false]], "interactive_figure": [[1, "module-interactive_figure", false]], "interactive_figure.interactive_figure": [[2, "module-interactive_figure.interactive_figure", false]], "module": [[1, "module-interactive_figure", false], [2, "module-interactive_figure.interactive_figure", false]], "toggle_fullscreen() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.toggle_fullscreen", false]], "wait() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.wait", false]], "wait_for_interaction() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.wait_for_interaction", false]]}, "objects": {"": [[1, 0, 0, "-", "interactive_figure"]], "interactive_figure": [[2, 0, 0, "-", "interactive_figure"]], "interactive_figure.interactive_figure": [[2, 1, 1, "", "clear"], [2, 1, 1, "", "close"], [2, 1, 1, "", "create"], [2, 1, 1, "", "draw"], [2, 1, 1, "", "get_last_key_press"], [2, 1, 1, "", "get_last_mouse_pos"], [2, 1, 1, "", "get_last_mouse_press"], [2, 1, 1, "", "toggle_fullscreen"], [2, 1, 1, "", "wait"], [2, 1, 1, "", "wait_for_interaction"]]}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "function", "Python function"]}, "objtypes": {"0": "py:module", "1": "py:function"}, "terms": {"0": 2, "1": [0, 2], "100": 2, "For": 2, "The": 2, "after": 2, "all": 2, "an": [], "ani": 2, "api": 3, "ar": 2, "argument": 2, "aspect": 2, "aspect_ratio": 2, "auto": [0, 2], "autoapi": 0, "ax": 2, "bool": 2, "button": 2, "clear": 2, "close": 2, "com": 2, "contain": 0, "control": [], "convert": [], "creat": [0, 2], "creation": 2, "default": 2, "document": 0, "draw": 2, "dure": 2, "fals": 2, "figur": 2, "fine": [], "float": 2, "freez": 2, "from": 2, "fullscreen": 2, "gener": 0, "get": 2, "get_last_key_press": 2, "get_last_mouse_po": 2, "get_last_mouse_press": 2, "github": 2, "given": 2, "grain": [], "ha": [], "hide": 2, "hide_label": 2, "hide_toolbar": 2, "http": 2, "i": 2, "id": 2, "identifi": 2, "input": 2, "instead": 2, "int": 2, "integ": [], "interact": 2, "interactive_figur": [0, 3], "kei": 2, "keyboard": 2, "keypress": [], "kwarg": 2, "label": 2, "last": 2, "layout": 2, "limit": 2, "locat": 2, "lowercas": 2, "matplotlib": 2, "mous": 2, "mousepress": [], "multipl": 2, "none": 2, "number": 2, "option": 2, "over": [], "page": 0, "period": 2, "posit": 2, "possibl": 2, "press": 2, "provid": 2, "ratio": 2, "refer": 3, "regist": 2, "remain": 2, "remov": 2, "reset": 2, "runtimeerror": 2, "second": 2, "sent": 2, "set": 2, "set_limit": 2, "sourc": 2, "sphinx": 0, "str": 2, "sub": 2, "teuncm": 2, "thi": [0, 2], "time": 2, "timeout": 2, "toggl": 2, "toggle_fullscreen": 2, "toolbar": 2, "true": 2, "upon": 2, "us": 2, "user": [], "valu": [], "wa": 2, "wait": 2, "wait_for_interact": 2, "when": 2, "whether": 2, "within": 2, "x": 2, "y": 2}, "titles": ["API Reference", "interactive_figure", "interactive_figure.interactive_figure", "Welcome to Interactive Figure\u2019s documentation!"], "titleterms": {"": 3, "api": 0, "content": 2, "document": 3, "figur": 3, "function": 2, "interact": 3, "interactive_figur": [1, 2], "modul": 2, "paramet": 2, "rais": 2, "refer": 0, "return": 2, "submodul": 1, "welcom": 3}})
@@ -0,0 +1 @@
1
+ __version__ = "0.3.6"
@@ -7,6 +7,7 @@ Source: https://github.com/teuncm/interactive-figure
7
7
 
8
8
  import matplotlib.pyplot as plt
9
9
  from types import SimpleNamespace
10
+ import sys
10
11
 
11
12
 
12
13
  def create(aspect_ratio="auto", hide_toolbar=False, **kwargs):
@@ -15,14 +16,14 @@ def create(aspect_ratio="auto", hide_toolbar=False, **kwargs):
15
16
  Parameters
16
17
  ----------
17
18
  aspect_ratio : str, optional
18
- aspect ratio of the Axes, by default "auto"
19
+ aspect ratio of the Axes, default "auto".
19
20
  hide_toolbar : bool, optional
20
- whether to hide the toolbar, by default False
21
+ whether to hide the toolbar, default False.
21
22
 
22
- remaining arguments will be sent to the figure upon creation
23
+ Remaining arguments will be sent to the figure upon creation.
23
24
 
24
25
  Raises
25
- ------
26
+ ----------
26
27
  RuntimeError
27
28
  if multiple interactive figures are created.
28
29
  """
@@ -57,10 +58,12 @@ def create(aspect_ratio="auto", hide_toolbar=False, **kwargs):
57
58
  fig.canvas.mpl_disconnect(fig.canvas.manager.button_press_handler_id)
58
59
  fig.canvas.mpl_connect("key_press_event", _key_press_handler)
59
60
  fig.canvas.mpl_connect("button_press_event", _button_press_handler)
61
+ fig.canvas.mpl_connect("close_event", _close_handler)
60
62
 
61
- print("Successfully created the interactive figure.")
63
+ print("Interactive figure: created")
62
64
  else:
63
- raise RuntimeError("Error: you cannot create multiple interactive figures.")
65
+ raise RuntimeError("Error: you cannot create multiple interactive figures at the same time.")
66
+
64
67
 
65
68
  def draw():
66
69
  """Draw contents of the figure."""
@@ -75,10 +78,15 @@ def draw():
75
78
 
76
79
 
77
80
  def clear(hide_labels=False, set_limits=True):
78
- """Reset contents and layout of the figure.
79
-
80
- *set_limits* will set the Axes limits to
81
- [0, 100]. *hide_labels* will remove all labels."""
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
90
  _check_exists()
83
91
 
84
92
  ax = _state.ax
@@ -104,13 +112,13 @@ def close():
104
112
  """Close the figure."""
105
113
  _check_exists()
106
114
 
115
+ _state.closed_using_ui = False
107
116
  plt.close(_state.fig)
108
117
 
118
+ # Handle proper closure so that the figure can be reused.
109
119
  _state_reset_fig()
110
120
  _state_reset_press()
111
121
 
112
- print("Successfully closed the interactive figure.")
113
-
114
122
 
115
123
  def wait_for_interaction(timeout=-1):
116
124
  """Wait for interaction.
@@ -160,7 +168,7 @@ def wait_for_interaction(timeout=-1):
160
168
  interaction_type = None if event is None else event.name == "key_press_event"
161
169
 
162
170
  if interaction_type is None:
163
- # No button was pressed, so reset the state.
171
+ # No button was pressed, so reset the press state.
164
172
  _state_reset_press()
165
173
 
166
174
  return interaction_type
@@ -172,7 +180,7 @@ def get_last_key_press():
172
180
  Returns
173
181
  -------
174
182
  str | None
175
- The last key that was pressed
183
+ The last key that was pressed.
176
184
  """
177
185
  _check_exists()
178
186
 
@@ -190,7 +198,7 @@ def get_last_mouse_press():
190
198
  Returns
191
199
  -------
192
200
  int | None
193
- The identifier of the last mouse button that was pressed
201
+ The identifier of the last mouse button that was pressed.
194
202
  """
195
203
  _check_exists()
196
204
 
@@ -208,7 +216,7 @@ def get_last_mouse_pos():
208
216
  Returns
209
217
  -------
210
218
  (x: float, y: float) | (None, None)
211
- The last registered mouse position after any interaction
219
+ The last registered mouse position after any interaction.
212
220
  """
213
221
  _check_exists()
214
222
 
@@ -224,16 +232,16 @@ def wait(timeout):
224
232
  Parameters
225
233
  ----------
226
234
  timeout : float
227
- Number of seconds to wait for
235
+ Number of seconds to wait for.
228
236
  """
229
237
  _check_exists()
230
238
 
231
239
  _state.fig.canvas.start_event_loop(timeout=timeout)
232
- # No button was pressed, so reset the state.
240
+ # Reset the press state.
233
241
  _state_reset_press()
234
242
 
235
243
 
236
- # PRIVATE METHODS
244
+ # HIDDEN METHODS
237
245
 
238
246
 
239
247
  def _get_state():
@@ -263,6 +271,7 @@ def _state_reset_fig():
263
271
  """Reset figure information."""
264
272
  _state.fig = None
265
273
  _state.ax = None
274
+ _state.closed_using_ui = True
266
275
 
267
276
 
268
277
  def _state_reset_press():
@@ -301,6 +310,23 @@ def _button_press_handler(event):
301
310
  _state.last_mouse_y = event.ydata
302
311
 
303
312
 
313
+ def _close_handler(event):
314
+ """Exit when the user presses the red x to close the figure
315
+ to prevent an infinite event loop.
316
+
317
+ Parameters
318
+ ----------
319
+ event
320
+ The event object that was generated internally
321
+ """
322
+ print("Interactive figure: closed")
323
+
324
+ # Triggered if the UI ('the red x') is used to close the figure.
325
+ if _state.closed_using_ui:
326
+ print("Interactive figure: exited script")
327
+ sys.exit(0)
328
+
329
+
304
330
  # Namespace to track the internal state of the interactive figure.
305
331
  _state = SimpleNamespace(
306
332
  fig=None,
@@ -309,4 +335,5 @@ _state = SimpleNamespace(
309
335
  last_mousepress=None,
310
336
  last_mouse_x=None,
311
337
  last_mouse_y=None,
338
+ closed_using_ui=True
312
339
  )
@@ -1 +0,0 @@
1
- Search.setIndex({"alltitles": {"API Reference": [[0, null]], "Functions": [[2, "functions"]], "Module Contents": [[2, "module-contents"]], "Parameters": [[2, "parameters"], [2, "id1"], [2, "id5"]], "Raises": [[2, "raises"]], "Returns": [[2, "returns"], [2, "id2"], [2, "id3"], [2, "id4"]], "Submodules": [[1, "submodules"]], "Welcome to Interactive Figure\u2019s documentation!": [[3, null]], "interactive_figure": [[1, null]], "interactive_figure.interactive_figure": [[2, null]]}, "docnames": ["autoapi/index", "autoapi/interactive_figure/index", "autoapi/interactive_figure/interactive_figure/index", "index"], "envversion": {"sphinx": 64, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2}, "filenames": ["autoapi\\index.rst", "autoapi\\interactive_figure\\index.rst", "autoapi\\interactive_figure\\interactive_figure\\index.rst", "index.rst"], "indexentries": {"clear() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.clear", false]], "close() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.close", false]], "create() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.create", false]], "draw() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.draw", false]], "get_last_key_press() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.get_last_key_press", false]], "get_last_mouse_pos() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.get_last_mouse_pos", false]], "get_last_mouse_press() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.get_last_mouse_press", false]], "interactive_figure": [[1, "module-interactive_figure", false]], "interactive_figure.interactive_figure": [[2, "module-interactive_figure.interactive_figure", false]], "module": [[1, "module-interactive_figure", false], [2, "module-interactive_figure.interactive_figure", false]], "toggle_fullscreen() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.toggle_fullscreen", false]], "wait() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.wait", false]], "wait_for_interaction() (in module interactive_figure.interactive_figure)": [[2, "interactive_figure.interactive_figure.wait_for_interaction", false]]}, "objects": {"": [[1, 0, 0, "-", "interactive_figure"]], "interactive_figure": [[2, 0, 0, "-", "interactive_figure"]], "interactive_figure.interactive_figure": [[2, 1, 1, "", "clear"], [2, 1, 1, "", "close"], [2, 1, 1, "", "create"], [2, 1, 1, "", "draw"], [2, 1, 1, "", "get_last_key_press"], [2, 1, 1, "", "get_last_mouse_pos"], [2, 1, 1, "", "get_last_mouse_press"], [2, 1, 1, "", "toggle_fullscreen"], [2, 1, 1, "", "wait"], [2, 1, 1, "", "wait_for_interaction"]]}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "function", "Python function"]}, "objtypes": {"0": "py:module", "1": "py:function"}, "terms": {"0": 2, "1": [0, 2], "100": 2, "For": 2, "The": 2, "after": 2, "all": 2, "an": [], "ani": 2, "api": 3, "ar": 2, "argument": 2, "aspect": 2, "aspect_ratio": 2, "auto": [0, 2], "autoapi": 0, "ax": 2, "bool": 2, "button": 2, "clear": 2, "close": 2, "com": 2, "contain": 0, "control": [], "convert": [], "creat": [0, 2], "creation": 2, "default": 2, "document": 0, "draw": 2, "dure": 2, "fals": 2, "figur": 2, "fine": [], "float": 2, "freez": 2, "fullscreen": 2, "gener": 0, "get": 2, "get_last_key_press": 2, "get_last_mouse_po": 2, "get_last_mouse_press": 2, "github": 2, "given": 2, "grain": [], "ha": [], "hide": 2, "hide_label": 2, "hide_toolbar": 2, "http": 2, "i": 2, "id": 2, "identifi": 2, "input": 2, "instead": 2, "int": 2, "integ": [], "interact": 2, "interactive_figur": [0, 3], "kei": 2, "keyboard": 2, "keypress": [], "kwarg": 2, "label": 2, "last": 2, "layout": 2, "limit": 2, "locat": 2, "lowercas": 2, "matplotlib": 2, "mous": 2, "mousepress": [], "multipl": 2, "none": 2, "number": 2, "option": 2, "over": [], "page": 0, "period": 2, "posit": 2, "possibl": 2, "press": 2, "provid": 2, "ratio": 2, "refer": 3, "regist": 2, "remain": 2, "remov": 2, "reset": 2, "runtimeerror": 2, "second": 2, "sent": 2, "set": 2, "set_limit": 2, "sourc": 2, "sphinx": 0, "str": 2, "sub": 2, "teuncm": 2, "thi": [0, 2], "time": 2, "timeout": 2, "toggl": 2, "toggle_fullscreen": 2, "toolbar": 2, "true": 2, "upon": 2, "us": 2, "user": [], "valu": [], "wa": 2, "wait": 2, "wait_for_interact": 2, "when": 2, "whether": 2, "within": 2, "x": 2, "y": 2}, "titles": ["API Reference", "interactive_figure", "interactive_figure.interactive_figure", "Welcome to Interactive Figure\u2019s documentation!"], "titleterms": {"": 3, "api": 0, "content": 2, "document": 3, "figur": 3, "function": 2, "interact": 3, "interactive_figur": [1, 2], "modul": 2, "paramet": 2, "rais": 2, "refer": 0, "return": 2, "submodul": 1, "welcom": 3}})
@@ -1 +0,0 @@
1
- __version__ = "0.3.4"