diplotocus 0.3.3__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 (118) hide show
  1. {diplotocus-0.3.3 → diplotocus-0.3.6}/.gitignore +2 -1
  2. {diplotocus-0.3.3 → diplotocus-0.3.6}/PKG-INFO +2 -2
  3. diplotocus-0.3.6/docs/source/_static/logo.mp4 +0 -0
  4. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/api/core.rst +1 -1
  5. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/index.rst +1 -0
  6. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/notebooks/animations.ipynb +16 -9
  7. {diplotocus-0.3.3 → diplotocus-0.3.6}/readme.md +1 -1
  8. diplotocus-0.3.6/src/diplotocus/_version.py +1 -0
  9. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/animations.py +55 -57
  10. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/core.py +64 -23
  11. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus.egg-info/PKG-INFO +2 -2
  12. diplotocus-0.3.3/docs/source/_static/logo.mp4 +0 -0
  13. diplotocus-0.3.3/src/diplotocus/_version.py +0 -1
  14. {diplotocus-0.3.3 → diplotocus-0.3.6}/.gitattributes +0 -0
  15. {diplotocus-0.3.3 → diplotocus-0.3.6}/.readthedocs.yaml +0 -0
  16. {diplotocus-0.3.3 → diplotocus-0.3.6}/LICENSE +0 -0
  17. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/Makefile +0 -0
  18. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/_static/force-light.css +0 -0
  19. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/_static/force-light.js +0 -0
  20. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/make.bat +0 -0
  21. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/requirements.txt +0 -0
  22. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/Web_GUI.png +0 -0
  23. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/anim_draw.mp4 +0 -0
  24. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/anim_morph.mp4 +0 -0
  25. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/anim_rotate.mp4 +0 -0
  26. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/anim_scale.mp4 +0 -0
  27. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/anim_sequence.mp4 +0 -0
  28. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/anim_translate.mp4 +0 -0
  29. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/anim_tween.mp4 +0 -0
  30. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/axis_alpha.mp4 +0 -0
  31. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/axis_limits.mp4 +0 -0
  32. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/axis_move.mp4 +0 -0
  33. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/axis_zoom.mp4 +0 -0
  34. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/button.svg +0 -0
  35. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/cubicBezier.mp4 +0 -0
  36. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/customEase.mp4 +0 -0
  37. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/demo.mp4 +0 -0
  38. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInBack.mp4 +0 -0
  39. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInBounce.mp4 +0 -0
  40. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInCirc.mp4 +0 -0
  41. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInCubic.mp4 +0 -0
  42. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInElastic.mp4 +0 -0
  43. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInExpo.mp4 +0 -0
  44. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInOutBack.mp4 +0 -0
  45. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInOutBounce.mp4 +0 -0
  46. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInOutCirc.mp4 +0 -0
  47. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInOutCubic.mp4 +0 -0
  48. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInOutElastic.mp4 +0 -0
  49. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInOutExpo.mp4 +0 -0
  50. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInOutQuad.mp4 +0 -0
  51. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInOutQuart.mp4 +0 -0
  52. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInOutQuint.mp4 +0 -0
  53. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInOutSine.mp4 +0 -0
  54. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInQuad.mp4 +0 -0
  55. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInQuart.mp4 +0 -0
  56. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInQuint.mp4 +0 -0
  57. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeInSine.mp4 +0 -0
  58. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeLinear.mp4 +0 -0
  59. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeOutBack.mp4 +0 -0
  60. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeOutBounce.mp4 +0 -0
  61. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeOutCirc.mp4 +0 -0
  62. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeOutCubic.mp4 +0 -0
  63. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeOutElastic.mp4 +0 -0
  64. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeOutExpo.mp4 +0 -0
  65. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeOutQuad.mp4 +0 -0
  66. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeOutQuart.mp4 +0 -0
  67. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeOutQuint.mp4 +0 -0
  68. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/easeOutSine.mp4 +0 -0
  69. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/favicon.ico +0 -0
  70. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/fig_height_ratio.mp4 +0 -0
  71. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/fig_width_ratio.mp4 +0 -0
  72. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/force-light.css +0 -0
  73. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/force-light.js +0 -0
  74. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/_static/logo.svg +0 -0
  75. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/api/index.rst +0 -0
  76. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/conf.py +0 -0
  77. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/notebooks/GUI.ipynb +0 -0
  78. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/notebooks/easings.ipynb +0 -0
  79. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/notebooks/index.ipynb +0 -0
  80. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/notebooks/installation.ipynb +0 -0
  81. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/notebooks/logo.ipynb +0 -0
  82. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/notebooks/plot_objects.ipynb +0 -0
  83. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/notebooks/quick-start.ipynb +0 -0
  84. {diplotocus-0.3.3 → diplotocus-0.3.6}/docs/source/notebooks/timeline.ipynb +0 -0
  85. {diplotocus-0.3.3 → diplotocus-0.3.6}/logo.png +0 -0
  86. {diplotocus-0.3.3 → diplotocus-0.3.6}/pyproject.toml +0 -0
  87. {diplotocus-0.3.3 → diplotocus-0.3.6}/setup.cfg +0 -0
  88. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/GUI/GUI.html +0 -0
  89. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/GUI/__init__.py +0 -0
  90. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/GUI/app.js +0 -0
  91. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/GUI/server.py +0 -0
  92. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/GUI/src/bg.png +0 -0
  93. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/GUI/src/btn/btn_bg_Draw.png +0 -0
  94. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/GUI/src/btn/btn_bg_Morph.png +0 -0
  95. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/GUI/src/btn/btn_bg_Rotate.png +0 -0
  96. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/GUI/src/btn/btn_bg_Scale.png +0 -0
  97. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/GUI/src/btn/btn_bg_Sequence.png +0 -0
  98. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/GUI/src/btn/btn_bg_Translate.png +0 -0
  99. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/GUI/src/btn/btn_bg_Tween.png +0 -0
  100. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/GUI/src/btn/btn_bg_default.png +0 -0
  101. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/GUI/src/favicon.ico +0 -0
  102. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/GUI/src/logo_bg.png +0 -0
  103. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/GUI/style.css +0 -0
  104. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/__init__.py +0 -0
  105. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus/easings.py +0 -0
  106. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus.egg-info/SOURCES.txt +0 -0
  107. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus.egg-info/dependency_links.txt +0 -0
  108. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus.egg-info/requires.txt +0 -0
  109. {diplotocus-0.3.3 → diplotocus-0.3.6}/src/diplotocus.egg-info/top_level.txt +0 -0
  110. {diplotocus-0.3.3 → diplotocus-0.3.6}/tests/test.py +0 -0
  111. {diplotocus-0.3.3 → diplotocus-0.3.6}/tests/test10.py +0 -0
  112. {diplotocus-0.3.3 → diplotocus-0.3.6}/tests/test2.py +0 -0
  113. {diplotocus-0.3.3 → diplotocus-0.3.6}/tests/test3.py +0 -0
  114. {diplotocus-0.3.3 → diplotocus-0.3.6}/tests/test4.py +0 -0
  115. {diplotocus-0.3.3 → diplotocus-0.3.6}/tests/test5.py +0 -0
  116. {diplotocus-0.3.3 → diplotocus-0.3.6}/tests/test6.py +0 -0
  117. {diplotocus-0.3.3 → diplotocus-0.3.6}/tests/test7.py +0 -0
  118. {diplotocus-0.3.3 → diplotocus-0.3.6}/tests/test8.py +0 -0
@@ -12,4 +12,5 @@ generate_doc_api.py
12
12
  dist
13
13
  src/diplotocus/INFO
14
14
  INFO
15
- docs/build
15
+ docs/build
16
+ update.sh
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diplotocus
3
- Version: 0.3.3
3
+ Version: 0.3.6
4
4
  Summary: A python package to generate animations of matplotlib objects.
5
5
  Author-email: Tristan Boin <tristan.boin@obspm.fr>
6
6
  License-Expression: MIT
@@ -19,7 +19,7 @@ Dynamic: license-file
19
19
  <img width="300" src="https://github.com/titanbin/Diplotocus/blob/main/logo.png?raw=true" />
20
20
  </p>
21
21
 
22
- [![Documentation](https://img.shields.io/badge/docs-passing-success)](https://diplotocus.readthedocs.io) [![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/titanbin/Diplotocus/blob/main/LICENSEE) [![License](https://img.shields.io/pypi/v/diplotocus?color=blue)](https://pypi.org/project/diplotocus/)
22
+ [![Documentation](https://img.shields.io/badge/docs-passing-success)](https://diplotocus.readthedocs.io) [![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/titanbin/Diplotocus/blob/main/LICENSE) [![License](https://img.shields.io/pypi/v/diplotocus?color=blue)](https://pypi.org/project/diplotocus/)
23
23
 
24
24
  **Diplotocus** is a python package designed to render animations of matplotlib objects, in a *timeline* style.
25
25
 
File without changes
@@ -15,7 +15,7 @@ Animations
15
15
  Base
16
16
  ~~~~
17
17
 
18
- .. autoclass:: diplotocus.animations.Animation
18
+ .. autoclass:: diplotocus.animations.plotObject
19
19
  :members:
20
20
  :undoc-members:
21
21
  :show-inheritance:
@@ -78,6 +78,7 @@ Get started by :doc:`Installing Diplotocus <notebooks/installation>`, and follow
78
78
  notebooks/plot_objects
79
79
  notebooks/animations
80
80
  notebooks/easings
81
+ notebooks/projects
81
82
  notebooks/GUI
82
83
 
83
84
  .. toctree::
@@ -14,7 +14,14 @@
14
14
  "\n",
15
15
  "Once animations have been set on plot objects, they have to be rendered via `Timeline.animate(plot_objs)` ([See Timeline](timeline)).\n",
16
16
  "\n",
17
- "## Animations of plot objects"
17
+ "## Animations of plot objects\n",
18
+ "\n",
19
+ "### Plot\n",
20
+ "\n",
21
+ "```{eval-rst}\n",
22
+ ".. automethod:: diplotocus.animations.plotObject.plot\n",
23
+ " :noindex:\n",
24
+ "```"
18
25
  ]
19
26
  },
20
27
  {
@@ -25,7 +32,7 @@
25
32
  "### Translate\n",
26
33
  "\n",
27
34
  "```{eval-rst}\n",
28
- ".. automethod:: diplotocus.animations.Animation.translate\n",
35
+ ".. automethod:: diplotocus.animations.plotObject.translate\n",
29
36
  " :noindex:\n",
30
37
  "```"
31
38
  ]
@@ -102,7 +109,7 @@
102
109
  "### Rotate\n",
103
110
  "\n",
104
111
  "```{eval-rst}\n",
105
- ".. automethod:: diplotocus.animations.Animation.rotate\n",
112
+ ".. automethod:: diplotocus.animations.plotObject.rotate\n",
106
113
  " :noindex:\n",
107
114
  "```"
108
115
  ]
@@ -179,7 +186,7 @@
179
186
  "### Scale\n",
180
187
  "\n",
181
188
  "```{eval-rst}\n",
182
- ".. automethod:: diplotocus.animations.Animation.scale\n",
189
+ ".. automethod:: diplotocus.animations.plotObject.scale\n",
183
190
  " :noindex:\n",
184
191
  "```"
185
192
  ]
@@ -256,12 +263,12 @@
256
263
  "### Tween\n",
257
264
  "\n",
258
265
  "```{eval-rst}\n",
259
- ".. automethod:: diplotocus.animations.Animation.tween\n",
266
+ ".. automethod:: diplotocus.animations.plotObject.tween\n",
260
267
  " :noindex:\n",
261
268
  "```\n",
262
269
  "\n",
263
270
  "```{eval-rst}\n",
264
- ".. automethod:: diplotocus.animations.Animation.tweens\n",
271
+ ".. automethod:: diplotocus.animations.plotObject.tweens\n",
265
272
  " :noindex:\n",
266
273
  "```\n",
267
274
  "\n",
@@ -345,7 +352,7 @@
345
352
  "### Morph\n",
346
353
  "\n",
347
354
  "```{eval-rst}\n",
348
- ".. automethod:: diplotocus.animations.Animation.morph\n",
355
+ ".. automethod:: diplotocus.animations.plotObject.morph\n",
349
356
  " :noindex:\n",
350
357
  "```"
351
358
  ]
@@ -426,7 +433,7 @@
426
433
  "### Draw\n",
427
434
  "\n",
428
435
  "```{eval-rst}\n",
429
- ".. automethod:: diplotocus.animations.Animation.draw\n",
436
+ ".. automethod:: diplotocus.animations.plotObject.draw\n",
430
437
  " :noindex:\n",
431
438
  "```"
432
439
  ]
@@ -504,7 +511,7 @@
504
511
  "### Sequence\n",
505
512
  "\n",
506
513
  "```{eval-rst}\n",
507
- ".. automethod:: diplotocus.animations.Animation.sequence\n",
514
+ ".. automethod:: diplotocus.animations.plotObject.sequence\n",
508
515
  " :noindex:\n",
509
516
  "```"
510
517
  ]
@@ -2,7 +2,7 @@
2
2
  <img width="300" src="https://github.com/titanbin/Diplotocus/blob/main/logo.png?raw=true" />
3
3
  </p>
4
4
 
5
- [![Documentation](https://img.shields.io/badge/docs-passing-success)](https://diplotocus.readthedocs.io) [![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/titanbin/Diplotocus/blob/main/LICENSEE) [![License](https://img.shields.io/pypi/v/diplotocus?color=blue)](https://pypi.org/project/diplotocus/)
5
+ [![Documentation](https://img.shields.io/badge/docs-passing-success)](https://diplotocus.readthedocs.io) [![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/titanbin/Diplotocus/blob/main/LICENSE) [![License](https://img.shields.io/pypi/v/diplotocus?color=blue)](https://pypi.org/project/diplotocus/)
6
6
 
7
7
  **Diplotocus** is a python package designed to render animations of matplotlib objects, in a *timeline* style.
8
8
 
@@ -0,0 +1 @@
1
+ __version__ = "0.3.6"
@@ -32,16 +32,12 @@ def to_np_array(obj):
32
32
  obj = np.ravel(obj)
33
33
  return obj
34
34
 
35
- class Animation:
35
+ class plotObject:
36
36
  """
37
- A parent Animation object for all plotting objects.
37
+ A parent plotObject object for all plotting objects.
38
38
 
39
39
  Parameters
40
40
  ----------
41
- duration : float
42
- Duration of the animation
43
- delay : float, default=0
44
- Delay before starting
45
41
  easing : callable, optional
46
42
  Easing function
47
43
  axis : matplotlib.axes.Axes, optional
@@ -332,6 +328,29 @@ class Animation:
332
328
  ends[i] = list(mpl.colors.to_rgba_array(ends[i])[0])
333
329
  return properties,starts,ends
334
330
 
331
+ def plot(self,duration,delay=0,easing=None,persistent=True):
332
+ """Plot the plot object as-is without animation.
333
+
334
+ Parameters
335
+ ----------
336
+ duration : float
337
+ the number of frames the animation runs from.
338
+ delay : float, default=0
339
+ the number of frames after what the animation starts playing.
340
+ easing : callable, optional
341
+ the easing used for this animation. If None, a linear easing is applied.
342
+ """
343
+ self.anims.append({
344
+ 'name':'plot',
345
+ 'duration':duration,
346
+ 'delay':delay,
347
+ 'easing':easing,
348
+ 'persistent':persistent,
349
+ 'played':False
350
+ })
351
+ self.compute_timings()
352
+ return self
353
+
335
354
  def tween(self,property,start,end,duration,delay=0,easing=None,persistent=True):
336
355
  """Animate a change in a property of the plot object.
337
356
 
@@ -839,7 +858,7 @@ class Animation:
839
858
  cy = 0.5 * (bbox.y0 + bbox.y1)
840
859
  return (cx,cy)
841
860
 
842
- class axis_zoom(Animation):
861
+ class axis_zoom(plotObject):
843
862
  """
844
863
  Zooms into the axis given a zoom value.
845
864
 
@@ -855,11 +874,6 @@ class axis_zoom(Animation):
855
874
  Easing function
856
875
  axis : matplotlib.axes.Axes, optional
857
876
  Axis to plot on
858
-
859
- Example
860
- --------
861
- Zoom 2 times in 100 frames:
862
- >>> axis_zoom(zoom=2,duration=100)
863
877
  """
864
878
  def __init__(self,zoom,duration,delay=0,easing=None,axis=None,*args,**kwargs):
865
879
  super().__init__(axis=axis,*args, **kwargs)
@@ -896,7 +910,7 @@ class axis_zoom(Animation):
896
910
  self.axis.set_xlim(x_range[0],x_range[1])
897
911
  self.axis.set_ylim(y_range[0],y_range[1])
898
912
 
899
- class axis_limits(Animation):
913
+ class axis_limits(plotObject):
900
914
  """
901
915
  Reframe axis to the given limits (on the x-axis, y-axis or both depending on passed arguments)
902
916
 
@@ -914,11 +928,6 @@ class axis_limits(Animation):
914
928
  Easing function
915
929
  axis : matplotlib.axes.Axes, optional
916
930
  Axis to plot on
917
-
918
- Example
919
- --------
920
- Reframe x-axis to limits [0-2] in 100 frames:
921
- >>> axis_limits(xlim=(0,2),duration=100)
922
931
  """
923
932
  def __init__(self,duration,xlim=None,ylim=None,delay=0,easing=None,axis=None,*args,**kwargs):
924
933
  if xlim is None and ylim is None:
@@ -957,7 +966,7 @@ class axis_limits(Animation):
957
966
  ylim_top = anim['start_ylim'][1] + (anim['ylim'][1] - anim['start_ylim'][1])*t
958
967
  self.axis.set_ylim(ylim_bottom,ylim_top)
959
968
 
960
- class axis_move(Animation):
969
+ class axis_move(plotObject):
961
970
  """
962
971
  Move the center of the axis to a given position.
963
972
 
@@ -973,11 +982,6 @@ class axis_move(Animation):
973
982
  Easing function
974
983
  axis : matplotlib.axes.Axes, optional
975
984
  Axis to plot on
976
-
977
- Example
978
- --------
979
- Recenter the axis to (-1,-1) in 100 frames:
980
- >>> axis_move(pos=(-1,-1),duration=100)
981
985
  """
982
986
  def __init__(self,end_pos,duration,start_pos=None,delay=0,easing=None,axis=None,*args,**kwargs):
983
987
  super().__init__(axis=axis,*args, **kwargs)
@@ -1013,7 +1017,7 @@ class axis_move(Animation):
1013
1017
  self.axis.set_xlim(pos_x-width/2,pos_x+width/2)
1014
1018
  self.axis.set_ylim(pos_y-height/2,pos_y+height/2)
1015
1019
 
1016
- class axis_alpha(Animation):
1020
+ class axis_alpha(plotObject):
1017
1021
  """
1018
1022
  Change the opacity of the axis.
1019
1023
 
@@ -1031,11 +1035,6 @@ class axis_alpha(Animation):
1031
1035
  Easing function
1032
1036
  axis : matplotlib.axes.Axes, optional
1033
1037
  Axis to plot on
1034
-
1035
- Example
1036
- --------
1037
- Make the axis appear in 100 frames
1038
- >>> axis_alpha(start_alpha=0,end_alpha=1,duration=100)
1039
1038
  """
1040
1039
  def __init__(self,start_alpha,end_alpha,duration,delay=0,alpha_objs=True,easing=None,axis=None,*args,**kwargs):
1041
1040
  super().__init__(axis=axis,*args, **kwargs)
@@ -1099,7 +1098,7 @@ class axis_alpha(Animation):
1099
1098
  for txt in leg.get_texts():
1100
1099
  txt.set_alpha(alpha)
1101
1100
 
1102
- class fig_width_ratio(Animation):
1101
+ class fig_width_ratio(plotObject):
1103
1102
  """
1104
1103
  Resize subplots' widths.
1105
1104
 
@@ -1117,11 +1116,6 @@ class fig_width_ratio(Animation):
1117
1116
  Easing function
1118
1117
  axis : matplotlib.axes.Axes, optional
1119
1118
  Axis to plot on
1120
-
1121
- Example
1122
- --------
1123
- Resize 2 subplots from equal widths to a ratio of 2:1 in 100 frames:
1124
- >>> fig_width_ratio(start_widths=(1,1),end_widths=(1,2),duration=100)
1125
1119
  """
1126
1120
  def __init__(self,start_widths,end_widths,duration,delay=0,easing=None,axis=None,*args,**kwargs):
1127
1121
  super().__init__(axis=axis,*args, **kwargs)
@@ -1175,7 +1169,7 @@ class fig_width_ratio(Animation):
1175
1169
  if row[i].axison == False:
1176
1170
  row[i].set_axis_on()
1177
1171
 
1178
- class fig_height_ratio(Animation):
1172
+ class fig_height_ratio(plotObject):
1179
1173
  """
1180
1174
  Resize subplots' heights.
1181
1175
 
@@ -1193,11 +1187,6 @@ class fig_height_ratio(Animation):
1193
1187
  Easing function
1194
1188
  axis : matplotlib.axes.Axes, optional
1195
1189
  Axis to plot on
1196
-
1197
- Example
1198
- --------
1199
- Resize 2 subplots from equal heights to a ratio of 2:1 in 100 frames:
1200
- >>> fig_width_ratio(start_heights=(1,1),end_heights=(1,2),duration=100)
1201
1190
  """
1202
1191
  def __init__(self,start_heights,end_heights,duration,delay=0,easing=None,axis=None,*args,**kwargs):
1203
1192
  super().__init__(axis=axis,*args, **kwargs)
@@ -1251,7 +1240,7 @@ class fig_height_ratio(Animation):
1251
1240
  if column[i].axison == False:
1252
1241
  column[i].set_axis_on()
1253
1242
 
1254
- class scatter(Animation):
1243
+ class scatter(plotObject):
1255
1244
  """
1256
1245
  A scatter plot of *y* vs. *x* with varying marker size and/or color.
1257
1246
 
@@ -1479,9 +1468,10 @@ class scatter(Animation):
1479
1468
  c = to_np_array(kwargs['c'])
1480
1469
  if c.ndim == 1 and (len(c) == 3 or len(c) == 4) and len(c) != len(data_x) and (c <= 1).all():
1481
1470
  kwargs['c'] = c.reshape(1,-1)
1471
+
1482
1472
  self.obj = self.axis.scatter(data_x,data_y,**kwargs)
1483
1473
 
1484
- class plot(Animation):
1474
+ class plot(plotObject):
1485
1475
  """
1486
1476
  Plot y versus x as lines and/or markers.
1487
1477
 
@@ -1797,7 +1787,7 @@ class plot(Animation):
1797
1787
  kwargs['alpha'] = kwargs['alpha'][0]
1798
1788
  self.obj = self.axis.plot(data_x,data_y,**kwargs)
1799
1789
 
1800
- class step(Animation):
1790
+ class step(plotObject):
1801
1791
  """
1802
1792
  Make a step plot.
1803
1793
 
@@ -1877,7 +1867,7 @@ class step(Animation):
1877
1867
 
1878
1868
  self.obj = self.axis.step(data_x,data_y,**kwargs)
1879
1869
 
1880
- class fill_between(Animation):
1870
+ class fill_between(plotObject):
1881
1871
  """
1882
1872
  Fill the area between two horizontal curves.
1883
1873
 
@@ -2045,7 +2035,7 @@ class fill_between(Animation):
2045
2035
  def function(self,data_x,data_y,x,kwargs):
2046
2036
  self.obj = self.axis.fill_between(x=data_x,**kwargs)
2047
2037
 
2048
- class fill_betweenx(Animation):
2038
+ class fill_betweenx(plotObject):
2049
2039
  """
2050
2040
  Fill the area between two vertical curves.
2051
2041
 
@@ -2213,7 +2203,7 @@ class fill_betweenx(Animation):
2213
2203
  def function(self,data_x,data_y,x,kwargs):
2214
2204
  self.obj = self.axis.fill_betweenx(y=data_x,**kwargs)
2215
2205
 
2216
- class axvline(Animation):
2206
+ class axvline(plotObject):
2217
2207
  """
2218
2208
  Add a vertical line spanning the whole or fraction of the Axes.
2219
2209
 
@@ -2352,7 +2342,7 @@ class axvline(Animation):
2352
2342
  if len(data_x) > 0:
2353
2343
  self.obj = [self.axis.axvline(data_x,**kwargs)]
2354
2344
 
2355
- class axhline(Animation):
2345
+ class axhline(plotObject):
2356
2346
  """
2357
2347
  Add a horizontal line spanning the whole or fraction of the Axes.
2358
2348
 
@@ -2430,7 +2420,7 @@ class axhline(Animation):
2430
2420
  if len(data_x) > 0:
2431
2421
  self.obj = [self.axis.axhline(data_x,**kwargs)]
2432
2422
 
2433
- class errorbar(Animation):
2423
+ class errorbar(plotObject):
2434
2424
  """
2435
2425
  Plot y versus x as lines and/or markers with attached errorbars.
2436
2426
 
@@ -2667,7 +2657,7 @@ class errorbar(Animation):
2667
2657
  obj = [obj.lines[0]] + list(obj.lines[1]) + list(obj.lines[2])
2668
2658
  self.obj = obj
2669
2659
 
2670
- class hist(Animation):
2660
+ class hist(plotObject):
2671
2661
  """
2672
2662
  Compute and plot a histogram.
2673
2663
 
@@ -2922,7 +2912,7 @@ class hist(Animation):
2922
2912
 
2923
2913
  h,edges,self.obj = self.axis.hist(data_x,**kwargs)
2924
2914
 
2925
- class hist2d(Animation):
2915
+ class hist2d(plotObject):
2926
2916
  """
2927
2917
  Make a 2D histogram plot.
2928
2918
 
@@ -3072,6 +3062,9 @@ class hist2d(Animation):
3072
3062
  if 'color' in kwargs:
3073
3063
  kwargs.pop('color')
3074
3064
 
3065
+ data_x = np.array(data_x).flatten()
3066
+ data_y = np.array(data_y).flatten()
3067
+
3075
3068
  #Have to reset xlim and ylim because hist2d does not respect the imposed limits
3076
3069
  old_xlim = self.axis.get_xlim()
3077
3070
  old_ylim = self.axis.get_ylim()
@@ -3079,7 +3072,7 @@ class hist2d(Animation):
3079
3072
  self.axis.set_xlim(old_xlim)
3080
3073
  self.axis.set_ylim(old_ylim)
3081
3074
 
3082
- class contourf(Animation):
3075
+ class contourf(plotObject):
3083
3076
  """
3084
3077
  Plot filled contours.
3085
3078
 
@@ -3428,14 +3421,14 @@ class contourf(Animation):
3428
3421
  self.axis.set_xlim(old_xlim)
3429
3422
  self.axis.set_ylim(old_ylim)
3430
3423
 
3431
- class text(Animation):
3424
+ class text(plotObject):
3432
3425
  """
3433
3426
  Add text to the Axes.
3434
3427
 
3435
3428
  Add the text *s* to the Axes at location *x*, *y* in data coordinates,
3436
3429
  with a default ``horizontalalignment`` on the ``left`` and
3437
3430
  ``verticalalignment`` at the ``baseline``.
3438
-
3431
+
3439
3432
  Parameters
3440
3433
  ----------
3441
3434
  x, y : float
@@ -3585,11 +3578,15 @@ class text(Animation):
3585
3578
  def function(self,data_x,data_y,s,kwargs):
3586
3579
  if len(s) == 0:
3587
3580
  return
3581
+ if isinstance(kwargs['alpha'],np.ndarray):
3582
+ kwargs['alpha'] = kwargs['alpha'][0]
3583
+
3588
3584
  if 'fontsize' in kwargs:
3589
3585
  fp = FontProperties(size=kwargs['fontsize'])
3586
+ kwargs.pop('fontsize')
3590
3587
  else:
3591
3588
  fp = FontProperties()
3592
- tp = TextPath((data_x, data_y), s, prop=fp)
3589
+ tp = TextPath((0, 0), s, prop=fp)
3593
3590
  patch = PathPatch(tp, **kwargs)
3594
3591
  self.axis.add_patch(patch)
3595
3592
 
@@ -3602,12 +3599,13 @@ class text(Animation):
3602
3599
  T = (
3603
3600
  transforms.Affine2D()
3604
3601
  .scale(sx, sy)
3602
+ .translate(data_x, data_y)
3605
3603
  )
3606
3604
  patch.set_path(patch.get_path().transformed(T))
3607
3605
  self.path = patch.get_path()
3608
3606
  self.obj = patch
3609
3607
 
3610
- class svg(Animation):
3608
+ class svg(plotObject):
3611
3609
  """A vector SVG object.
3612
3610
 
3613
3611
  Parameters
@@ -1,10 +1,9 @@
1
1
  import numpy as np
2
2
  import subprocess,os,shlex,pickle
3
3
  import matplotlib.pyplot as plt
4
- import matplotlib
4
+ from matplotlib.backends.backend_agg import FigureCanvasAgg
5
5
  import warnings
6
6
  from copy import deepcopy
7
- matplotlib.use("Agg")
8
7
  import shutil
9
8
  try:
10
9
  has_ipython = True
@@ -59,11 +58,22 @@ def status_message(start_msg, end_msg):
59
58
  #----------------------------------------------
60
59
 
61
60
  def load_project(path):
61
+ """Load a project.
62
+
63
+ Parameters
64
+ ----------
65
+ path : str
66
+ the path to the project file.
67
+
68
+ Returns
69
+ ----------
70
+ (Timeline,list of plot objects)
71
+ """
62
72
  tl = pickle.load(open(path, 'rb'))
63
- animations = tl.animations
73
+ plot_objects = tl.plot_objects
64
74
  tl.x = 0
65
75
  tl.clean_all()
66
- return tl,animations
76
+ return tl,plot_objects
67
77
 
68
78
  class Timeline:
69
79
  """Create and manage an animation timeline.
@@ -117,11 +127,11 @@ class Timeline:
117
127
  self.ax = np.array(self.ax)
118
128
  if isinstance(self.ax,np.ndarray):
119
129
  if isinstance(self.ax[0],np.ndarray):
120
- self.main_axis = self.ax[0,0]
130
+ self.set_main_axis(self.ax[0,0])
121
131
  else:
122
- self.main_axis = self.ax[0]
132
+ self.set_main_axis(self.ax[0])
123
133
  else:
124
- self.main_axis = self.ax
134
+ self.set_main_axis(self.ax)
125
135
  if xlim is not None:
126
136
  self.main_axis.set_xlim(*xlim)
127
137
  if ylim is not None:
@@ -133,7 +143,7 @@ class Timeline:
133
143
  self.x = 0
134
144
  self.timeline_str = ''
135
145
  self.transparent = transparent
136
- self.animations = []
146
+ self.plot_objects = []
137
147
  if in_notebook() == False:
138
148
  namespace = sys._getframe(1).f_globals['__file__']
139
149
  self.full_path = '/'.join(namespace.split('/')[:-1])
@@ -142,7 +152,24 @@ class Timeline:
142
152
  if noaxis:
143
153
  self.main_axis.set_axis_off()
144
154
 
155
+ def set_main_axis(self,ax):
156
+ """Set the default axis to plot objects on
157
+
158
+ Parameters
159
+ ----------
160
+ ax : matplotlib.axes.Axes, optional
161
+ Axis to set as default
162
+ """
163
+ self.main_axis = ax
164
+
145
165
  def set_axis_color(self,color):
166
+ """Set the color of axes
167
+
168
+ Parameters
169
+ ----------
170
+ color : color or array-like, optional
171
+ The color to set the axes
172
+ """
146
173
  if isinstance(self.ax,np.ndarray) == False:
147
174
  axes = (self.ax,)
148
175
  else:
@@ -175,24 +202,24 @@ class Timeline:
175
202
  if p.get_animated():
176
203
  p.remove()
177
204
 
178
- def plot(self,animations,x=0,easing=None,debug=False):
179
- if isinstance(animations,Animation):
180
- animations = (animations,)
205
+ def plot(self,plot_objects,x=0,easing=None,debug=False):
206
+ if isinstance(plot_objects,plotObject):
207
+ plot_objects = (plot_objects,)
181
208
 
182
- for animation in animations:
183
- if animation.obj is not None and ((animation.x_min <= x < animation.x_max) or (x >= animation.x_max and animation.persistent == False)):
184
- objects = np.ravel(animation.obj)
209
+ for plot_object in plot_objects:
210
+ if plot_object.obj is not None and ((plot_object.x_min <= x < plot_object.x_max) or (x >= plot_object.x_max and plot_object.persistent == False)):
211
+ objects = np.ravel(plot_object.obj)
185
212
  for obj in objects:
186
213
  try:
187
214
  obj.remove()
188
215
  except:
189
216
  pass
190
217
 
191
- animation.initialize(self)
218
+ plot_object.initialize(self)
192
219
  #only plot if within an anim or if last one is persistent
193
220
  last_anim = None
194
221
  closest_dist = np.inf
195
- for anim in animation.anims:
222
+ for anim in plot_object.anims:
196
223
  anim_x_max = anim['duration']+anim['delay']
197
224
  if anim_x_max > x:
198
225
  continue
@@ -204,19 +231,19 @@ class Timeline:
204
231
  if last_anim is not None:
205
232
  is_within_anim = last_anim['persistent'] == True
206
233
  if is_within_anim == False:
207
- for anim in animation.anims:
234
+ for anim in plot_object.anims:
208
235
  anim_x_min = anim['delay']
209
236
  anim_x_max = anim['duration']+anim['delay']
210
237
  if anim_x_min <= x < anim_x_max:
211
238
  is_within_anim = True
212
239
  break
213
240
  if is_within_anim:
214
- animation.apply(x,easing)
241
+ plot_object.apply(x,easing)
215
242
  prev_x = self.x
216
243
  self.x = x
217
244
  self.save_plot(debug)
218
- for animation in animations:
219
- animation.clean(x,clear_anims=False)
245
+ for plot_object in plot_objects:
246
+ plot_object.clean(x,clear_anims=False)
220
247
  self.x = prev_x
221
248
 
222
249
  def animate(self,plot_objects,easing=None,debug=False):
@@ -224,14 +251,14 @@ class Timeline:
224
251
 
225
252
  Parameters
226
253
  ----------
227
- plot_objects : Animation or sequence of Animation
254
+ plot_objects : plotObject or sequence of plotObject
228
255
  a single plot object (e.g. `scatter`, `plot`, `hist`...) or a list of plot objects.
229
256
  easing : easing
230
257
  an easing override used while rendering.
231
258
  debug : bool
232
259
  if True, skip writing frame images to disk.
233
260
  """
234
- if isinstance(plot_objects,Animation):
261
+ if isinstance(plot_objects,plotObject):
235
262
  plot_objects = (plot_objects,)
236
263
  self.animations = deepcopy(np.array(plot_objects))
237
264
 
@@ -250,11 +277,15 @@ class Timeline:
250
277
  loop = tqdm(loop)
251
278
 
252
279
  for x in loop:
253
- self.plot(animations=plot_objects,x=x,easing=easing,debug=debug)
280
+ self.plot(plot_objects=plot_objects,x=x,easing=easing,debug=debug)
254
281
  for animation in plot_objects:
255
282
  for anim in animation.anims:
256
283
  anim['played'] = True
257
284
  self.x = x_max
285
+ for animation in plot_objects:
286
+ if self.x >= animation.x_max and animation.persistent == False:
287
+ animation.clean(animation.x_max - 2, clear_anims=False)
288
+ plt.close()
258
289
 
259
290
  def wait(self,duration):
260
291
  """Pause the animation for a number of frames.
@@ -280,6 +311,9 @@ class Timeline:
280
311
  if debug is False:
281
312
  if os.path.isdir(self.name) == False:
282
313
  os.makedirs(self.name)
314
+
315
+ FigureCanvasAgg(self.fig)
316
+
283
317
  fn = self.name + '/' + self.name + '_{}.png'.format(self.x)
284
318
  self.fig.savefig(fn,dpi=self.dpi,transparent=self.transparent)
285
319
 
@@ -354,5 +388,12 @@ class Timeline:
354
388
  """.format(video_fn,rand_id)))
355
389
 
356
390
  def save_project(self,path):
391
+ """Save the current Timeline and associated plot objects to a project file.
392
+
393
+ Parameters
394
+ ----------
395
+ path : str
396
+ The path to save the project file to.
397
+ """
357
398
  with open(path, 'wb') as f:
358
399
  pickle.dump(self, f)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diplotocus
3
- Version: 0.3.3
3
+ Version: 0.3.6
4
4
  Summary: A python package to generate animations of matplotlib objects.
5
5
  Author-email: Tristan Boin <tristan.boin@obspm.fr>
6
6
  License-Expression: MIT
@@ -19,7 +19,7 @@ Dynamic: license-file
19
19
  <img width="300" src="https://github.com/titanbin/Diplotocus/blob/main/logo.png?raw=true" />
20
20
  </p>
21
21
 
22
- [![Documentation](https://img.shields.io/badge/docs-passing-success)](https://diplotocus.readthedocs.io) [![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/titanbin/Diplotocus/blob/main/LICENSEE) [![License](https://img.shields.io/pypi/v/diplotocus?color=blue)](https://pypi.org/project/diplotocus/)
22
+ [![Documentation](https://img.shields.io/badge/docs-passing-success)](https://diplotocus.readthedocs.io) [![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/titanbin/Diplotocus/blob/main/LICENSE) [![License](https://img.shields.io/pypi/v/diplotocus?color=blue)](https://pypi.org/project/diplotocus/)
23
23
 
24
24
  **Diplotocus** is a python package designed to render animations of matplotlib objects, in a *timeline* style.
25
25
 
@@ -1 +0,0 @@
1
- __version__ = "0.3.3"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes