passagemath-plot 10.8.4__tar.gz → 10.8.5__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.
- {passagemath_plot-10.8.4/passagemath_plot.egg-info → passagemath_plot-10.8.5}/PKG-INFO +4 -4
- passagemath_plot-10.8.5/VERSION.txt +1 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5/passagemath_plot.egg-info}/PKG-INFO +4 -4
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/passagemath_plot.egg-info/requires.txt +3 -3
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/pyproject.toml +8 -8
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/animate.py +1 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/graphics.py +76 -2
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/multigraphics.py +70 -2
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/primitive.py +1 -0
- passagemath_plot-10.8.4/VERSION.txt +0 -1
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/MANIFEST.in +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/README.rst +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/passagemath_plot/__init__.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/passagemath_plot.egg-info/SOURCES.txt +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/passagemath_plot.egg-info/dependency_links.txt +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/passagemath_plot.egg-info/top_level.txt +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/all__sagemath_plot.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/ext_data/graphs/graph_plot_js.html +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/ext_data/threejs/animation.css +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/ext_data/threejs/animation.html +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/ext_data/threejs/animation.js +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/ext_data/threejs/fat_lines.js +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/ext_data/threejs/threejs-version.txt +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/ext_data/threejs/threejs_template.html +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/interfaces/all__sagemath_plot.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/interfaces/gnuplot.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/interfaces/jmoldata.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/interfaces/povray.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/all.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/arc.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/arrow.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/bar_chart.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/bezier_path.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/circle.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/colors.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/complex_plot.pyx +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/contour_plot.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/density_plot.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/disk.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/ellipse.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/histogram.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/hyperbolic_arc.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/hyperbolic_polygon.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/hyperbolic_regular_polygon.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/line.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/matrix_plot.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/meson.build +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/misc.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/all.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/base.pxd +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/base.pyx +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/bugs.txt +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/implicit_plot3d.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/implicit_surface.pyx +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/index_face_set.pxd +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/index_face_set.pyx +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/introduction.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/list_plot3d.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/meson.build +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/parametric_plot3d.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/parametric_surface.pxd +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/parametric_surface.pyx +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/platonic.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/plot3d.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/plot_field3d.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/point_c.pxi +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/revolution_plot3d.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/shapes.pxd +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/shapes.pyx +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/shapes2.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/tachyon.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/texture.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/transform.pxd +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/transform.pyx +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot3d/tri_plot.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/plot_field.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/point.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/polygon.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/scatter_plot.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/step.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/streamline_plot.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/plot/text.py +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/setup.cfg +0 -0
- {passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: passagemath-plot
|
|
3
|
-
Version: 10.8.
|
|
3
|
+
Version: 10.8.5
|
|
4
4
|
Summary: passagemath: Plotting and graphics with Matplotlib, Three.JS, etc.
|
|
5
5
|
Author-email: The Sage Developers <sage-support@googlegroups.com>
|
|
6
6
|
Maintainer: Matthias Köppe, passagemath contributors
|
|
@@ -34,8 +34,8 @@ Requires-Dist: gmpy2~=2.3.b1; sys_platform == "win32"
|
|
|
34
34
|
Requires-Dist: cysignals!=1.12.4; sys_platform == "win32"
|
|
35
35
|
Requires-Dist: cysignals!=1.12.0,>=1.11.2
|
|
36
36
|
Requires-Dist: memory_allocator<0.2
|
|
37
|
-
Requires-Dist: passagemath-categories~=10.8.
|
|
38
|
-
Requires-Dist: passagemath-modules~=10.8.
|
|
37
|
+
Requires-Dist: passagemath-categories~=10.8.5.0
|
|
38
|
+
Requires-Dist: passagemath-modules~=10.8.5.0
|
|
39
39
|
Requires-Dist: numpy>=1.25
|
|
40
40
|
Requires-Dist: numpy>=2.2.4
|
|
41
41
|
Requires-Dist: scipy>=1.11
|
|
@@ -54,7 +54,7 @@ Provides-Extra: matplotlib
|
|
|
54
54
|
Provides-Extra: playwright
|
|
55
55
|
Requires-Dist: playwright; extra == "playwright"
|
|
56
56
|
Provides-Extra: tachyon
|
|
57
|
-
Requires-Dist: passagemath-tachyon~=10.8.
|
|
57
|
+
Requires-Dist: passagemath-tachyon~=10.8.5.0; extra == "tachyon"
|
|
58
58
|
Provides-Extra: threejs
|
|
59
59
|
Provides-Extra: graphs
|
|
60
60
|
Requires-Dist: passagemath-graphs; extra == "graphs"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
10.8.5
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: passagemath-plot
|
|
3
|
-
Version: 10.8.
|
|
3
|
+
Version: 10.8.5
|
|
4
4
|
Summary: passagemath: Plotting and graphics with Matplotlib, Three.JS, etc.
|
|
5
5
|
Author-email: The Sage Developers <sage-support@googlegroups.com>
|
|
6
6
|
Maintainer: Matthias Köppe, passagemath contributors
|
|
@@ -34,8 +34,8 @@ Requires-Dist: gmpy2~=2.3.b1; sys_platform == "win32"
|
|
|
34
34
|
Requires-Dist: cysignals!=1.12.4; sys_platform == "win32"
|
|
35
35
|
Requires-Dist: cysignals!=1.12.0,>=1.11.2
|
|
36
36
|
Requires-Dist: memory_allocator<0.2
|
|
37
|
-
Requires-Dist: passagemath-categories~=10.8.
|
|
38
|
-
Requires-Dist: passagemath-modules~=10.8.
|
|
37
|
+
Requires-Dist: passagemath-categories~=10.8.5.0
|
|
38
|
+
Requires-Dist: passagemath-modules~=10.8.5.0
|
|
39
39
|
Requires-Dist: numpy>=1.25
|
|
40
40
|
Requires-Dist: numpy>=2.2.4
|
|
41
41
|
Requires-Dist: scipy>=1.11
|
|
@@ -54,7 +54,7 @@ Provides-Extra: matplotlib
|
|
|
54
54
|
Provides-Extra: playwright
|
|
55
55
|
Requires-Dist: playwright; extra == "playwright"
|
|
56
56
|
Provides-Extra: tachyon
|
|
57
|
-
Requires-Dist: passagemath-tachyon~=10.8.
|
|
57
|
+
Requires-Dist: passagemath-tachyon~=10.8.5.0; extra == "tachyon"
|
|
58
58
|
Provides-Extra: threejs
|
|
59
59
|
Provides-Extra: graphs
|
|
60
60
|
Requires-Dist: passagemath-graphs; extra == "graphs"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
gmpy2~=2.1.b999
|
|
2
2
|
cysignals!=1.12.0,>=1.11.2
|
|
3
3
|
memory_allocator<0.2
|
|
4
|
-
passagemath-categories~=10.8.
|
|
5
|
-
passagemath-modules~=10.8.
|
|
4
|
+
passagemath-categories~=10.8.5.0
|
|
5
|
+
passagemath-modules~=10.8.5.0
|
|
6
6
|
numpy>=1.25
|
|
7
7
|
numpy>=2.2.4
|
|
8
8
|
scipy>=1.11
|
|
@@ -36,7 +36,7 @@ passagemath-polyhedra
|
|
|
36
36
|
passagemath-symbolics
|
|
37
37
|
|
|
38
38
|
[tachyon]
|
|
39
|
-
passagemath-tachyon~=10.8.
|
|
39
|
+
passagemath-tachyon~=10.8.5.0
|
|
40
40
|
|
|
41
41
|
[test]
|
|
42
42
|
passagemath-repl
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
# Minimum requirements for the build system to execute.
|
|
3
3
|
requires = [
|
|
4
4
|
'setuptools >= 77.0.0',
|
|
5
|
-
'passagemath-conf ~= 10.8.
|
|
6
|
-
'passagemath-setup ~= 10.8.
|
|
5
|
+
'passagemath-conf ~= 10.8.5.0 ; sys_platform != "win32"',
|
|
6
|
+
'passagemath-setup ~= 10.8.5.0',
|
|
7
7
|
'pkgconfig',
|
|
8
|
-
'passagemath-environment ~= 10.8.
|
|
9
|
-
'passagemath-categories ~= 10.8.
|
|
10
|
-
'passagemath-modules ~= 10.8.
|
|
8
|
+
'passagemath-environment ~= 10.8.5.0',
|
|
9
|
+
'passagemath-categories ~= 10.8.5.0',
|
|
10
|
+
'passagemath-modules ~= 10.8.5.0',
|
|
11
11
|
'numpy >=1.25', 'numpy >=2.2.4',
|
|
12
12
|
'cython >=3.1.0,<3.3.0',
|
|
13
13
|
'gmpy2 ~=2.1.b999', 'gmpy2 ~=2.3.b1; sys_platform == "win32"',
|
|
@@ -23,8 +23,8 @@ dependencies = [
|
|
|
23
23
|
'gmpy2 ~=2.1.b999', 'gmpy2 ~=2.3.b1; sys_platform == "win32"',
|
|
24
24
|
'cysignals !=1.12.4; sys_platform == "win32"', 'cysignals >=1.11.2, != 1.12.0',
|
|
25
25
|
'memory_allocator <0.2',
|
|
26
|
-
'passagemath-categories ~= 10.8.
|
|
27
|
-
'passagemath-modules ~= 10.8.
|
|
26
|
+
'passagemath-categories ~= 10.8.5.0',
|
|
27
|
+
'passagemath-modules ~= 10.8.5.0',
|
|
28
28
|
'numpy >=1.25', 'numpy >=2.2.4',
|
|
29
29
|
'scipy >=1.11',
|
|
30
30
|
'pillow >=7.2.0',
|
|
@@ -81,7 +81,7 @@ dot2tex = ['dot2tex >=2.11.3', 'pyparsing <3.3',]
|
|
|
81
81
|
jsmol = ['jupyter-jsmol',]
|
|
82
82
|
matplotlib = [] # no extra needed
|
|
83
83
|
playwright = ['playwright',]
|
|
84
|
-
tachyon = ['passagemath-tachyon ~= 10.8.
|
|
84
|
+
tachyon = ['passagemath-tachyon ~= 10.8.5.0',]
|
|
85
85
|
threejs = [] # no extra needed
|
|
86
86
|
|
|
87
87
|
# extras by other features
|
|
@@ -131,6 +131,7 @@ import shlex
|
|
|
131
131
|
import struct
|
|
132
132
|
import zlib
|
|
133
133
|
|
|
134
|
+
import sage.structure.element # break Cython circular import (refs #1604)
|
|
134
135
|
from sage.misc.fast_methods import WithEqualityById
|
|
135
136
|
from sage.structure.sage_object import SageObject
|
|
136
137
|
from sage.misc.temporary_file import tmp_dir, tmp_filename
|
|
@@ -40,6 +40,7 @@ from collections.abc import Iterable
|
|
|
40
40
|
from math import isnan
|
|
41
41
|
import sage.misc.verbose
|
|
42
42
|
from sage.misc.temporary_file import tmp_filename
|
|
43
|
+
import sage.structure.element # break Cython circular import (refs #1604)
|
|
43
44
|
from sage.misc.fast_methods import WithEqualityById
|
|
44
45
|
from sage.structure.sage_object import SageObject
|
|
45
46
|
from sage.misc.decorators import suboptions
|
|
@@ -1040,6 +1041,76 @@ class Graphics(WithEqualityById, SageObject):
|
|
|
1040
1041
|
except Exception:
|
|
1041
1042
|
return None
|
|
1042
1043
|
|
|
1044
|
+
def _repr_svg_(self):
|
|
1045
|
+
r"""
|
|
1046
|
+
Return an SVG representation of this graphics object.
|
|
1047
|
+
|
|
1048
|
+
This allows ``Graphics`` objects to display as vector images in plain
|
|
1049
|
+
Python Jupyter kernels (e.g. xeus-python in JupyterLite, Google Colab,
|
|
1050
|
+
marimo) that do not use Sage's rich output system.
|
|
1051
|
+
|
|
1052
|
+
Unlike :meth:`_render_svg_`, rendering failures are suppressed and
|
|
1053
|
+
``None`` is returned, matching the IPython ``_repr_svg_`` protocol.
|
|
1054
|
+
|
|
1055
|
+
OUTPUT: string -- SVG image data, or ``None`` if rendering fails
|
|
1056
|
+
|
|
1057
|
+
EXAMPLES::
|
|
1058
|
+
|
|
1059
|
+
sage: G = line([(0, 0), (1, 1)])
|
|
1060
|
+
sage: svg = G._repr_svg_()
|
|
1061
|
+
sage: '<svg' in svg
|
|
1062
|
+
True
|
|
1063
|
+
"""
|
|
1064
|
+
try:
|
|
1065
|
+
return self._render_svg_().decode('utf-8')
|
|
1066
|
+
except Exception:
|
|
1067
|
+
return None
|
|
1068
|
+
|
|
1069
|
+
def _render_svg_(self, **kwds):
|
|
1070
|
+
r"""
|
|
1071
|
+
Render this graphics object to SVG bytes.
|
|
1072
|
+
|
|
1073
|
+
Used by :meth:`_repr_svg_` (plain Python kernels). Raises on rendering
|
|
1074
|
+
failure so that callers can surface errors.
|
|
1075
|
+
|
|
1076
|
+
Runtime keyword arguments (e.g. ``figsize``) overlay the instance's
|
|
1077
|
+
saved options, matching the merge order of :meth:`save`.
|
|
1078
|
+
|
|
1079
|
+
OUTPUT: ``bytes`` -- SVG image data (UTF-8 encoded XML)
|
|
1080
|
+
|
|
1081
|
+
EXAMPLES::
|
|
1082
|
+
|
|
1083
|
+
sage: G = line([(0, 0), (1, 1)])
|
|
1084
|
+
sage: svg = G._render_svg_()
|
|
1085
|
+
sage: b'<svg' in svg
|
|
1086
|
+
True
|
|
1087
|
+
"""
|
|
1088
|
+
from io import BytesIO
|
|
1089
|
+
from matplotlib import pyplot as plt, rcParams
|
|
1090
|
+
from matplotlib.backends.backend_svg import FigureCanvasSVG
|
|
1091
|
+
options = {}
|
|
1092
|
+
options.update(self.SHOW_OPTIONS)
|
|
1093
|
+
options.update(self._extra_kwds)
|
|
1094
|
+
options.update(kwds)
|
|
1095
|
+
options.pop('dpi', None)
|
|
1096
|
+
options.pop('transparent', None)
|
|
1097
|
+
options.pop('fig_tight', None)
|
|
1098
|
+
rc_backup = (rcParams['ps.useafm'], rcParams['pdf.use14corefonts'],
|
|
1099
|
+
rcParams['text.usetex'])
|
|
1100
|
+
figure = None
|
|
1101
|
+
try:
|
|
1102
|
+
figure = self.matplotlib(**options)
|
|
1103
|
+
figure.set_canvas(FigureCanvasSVG(figure))
|
|
1104
|
+
figure.tight_layout()
|
|
1105
|
+
buf = BytesIO()
|
|
1106
|
+
figure.savefig(buf, format='svg')
|
|
1107
|
+
return buf.getvalue()
|
|
1108
|
+
finally:
|
|
1109
|
+
if figure is not None:
|
|
1110
|
+
plt.close(figure)
|
|
1111
|
+
(rcParams['ps.useafm'], rcParams['pdf.use14corefonts'],
|
|
1112
|
+
rcParams['text.usetex']) = rc_backup
|
|
1113
|
+
|
|
1043
1114
|
def _render_png_(self, **kwds):
|
|
1044
1115
|
r"""
|
|
1045
1116
|
Render this graphics object to PNG bytes.
|
|
@@ -2279,8 +2350,11 @@ class Graphics(WithEqualityById, SageObject):
|
|
|
2279
2350
|
and dm.preferences.graphics != 'disable'):
|
|
2280
2351
|
try:
|
|
2281
2352
|
if _running_in_notebook():
|
|
2282
|
-
from IPython.display import display, Image
|
|
2283
|
-
|
|
2353
|
+
from IPython.display import display, SVG, Image
|
|
2354
|
+
try:
|
|
2355
|
+
display(SVG(self._render_svg_(**kwds).decode('utf-8')))
|
|
2356
|
+
except Exception:
|
|
2357
|
+
display(Image(self._render_png_(**kwds)))
|
|
2284
2358
|
return
|
|
2285
2359
|
except Exception:
|
|
2286
2360
|
pass
|
|
@@ -16,6 +16,7 @@ AUTHORS:
|
|
|
16
16
|
``GraphicsArray`` that was defined in the module :mod:`~sage.plot.graphics`.
|
|
17
17
|
"""
|
|
18
18
|
import os
|
|
19
|
+
import sage.structure.element # break Cython circular import (refs #1604)
|
|
19
20
|
from sage.misc.fast_methods import WithEqualityById
|
|
20
21
|
from sage.structure.sage_object import SageObject
|
|
21
22
|
from sage.misc.temporary_file import tmp_filename
|
|
@@ -238,6 +239,70 @@ class MultiGraphics(WithEqualityById, SageObject):
|
|
|
238
239
|
except Exception:
|
|
239
240
|
return None
|
|
240
241
|
|
|
242
|
+
def _repr_svg_(self):
|
|
243
|
+
r"""
|
|
244
|
+
Return an SVG representation of this graphics array.
|
|
245
|
+
|
|
246
|
+
This allows ``MultiGraphics`` objects to display as vector images in
|
|
247
|
+
plain Python Jupyter kernels that do not use Sage's rich output system.
|
|
248
|
+
|
|
249
|
+
Unlike :meth:`_render_svg_`, rendering failures are suppressed and
|
|
250
|
+
``None`` is returned, matching the IPython ``_repr_svg_`` protocol.
|
|
251
|
+
|
|
252
|
+
OUTPUT: string -- SVG image data, or ``None`` if rendering fails
|
|
253
|
+
|
|
254
|
+
EXAMPLES::
|
|
255
|
+
|
|
256
|
+
sage: G = graphics_array([line([(0,0),(1,1)]), circle((0,0),1)])
|
|
257
|
+
sage: svg = G._repr_svg_()
|
|
258
|
+
sage: '<svg' in svg
|
|
259
|
+
True
|
|
260
|
+
"""
|
|
261
|
+
try:
|
|
262
|
+
return self._render_svg_().decode('utf-8')
|
|
263
|
+
except Exception:
|
|
264
|
+
return None
|
|
265
|
+
|
|
266
|
+
def _render_svg_(self, **kwds):
|
|
267
|
+
r"""
|
|
268
|
+
Render this graphics array to SVG bytes.
|
|
269
|
+
|
|
270
|
+
Used by :meth:`_repr_svg_` (plain Python kernels). Raises on rendering
|
|
271
|
+
failure so that callers can surface errors.
|
|
272
|
+
|
|
273
|
+
Runtime keyword arguments (e.g. ``figsize``) are passed through to
|
|
274
|
+
:meth:`matplotlib`.
|
|
275
|
+
|
|
276
|
+
OUTPUT: ``bytes`` -- SVG image data (UTF-8 encoded XML)
|
|
277
|
+
|
|
278
|
+
EXAMPLES::
|
|
279
|
+
|
|
280
|
+
sage: G = graphics_array([line([(0,0),(1,1)]), circle((0,0),1)])
|
|
281
|
+
sage: svg = G._render_svg_()
|
|
282
|
+
sage: b'<svg' in svg
|
|
283
|
+
True
|
|
284
|
+
"""
|
|
285
|
+
from io import BytesIO
|
|
286
|
+
from matplotlib import pyplot as plt, rcParams
|
|
287
|
+
from matplotlib.backends.backend_svg import FigureCanvasSVG
|
|
288
|
+
figsize = kwds.pop('figsize', None)
|
|
289
|
+
rc_backup = (rcParams['ps.useafm'], rcParams['pdf.use14corefonts'],
|
|
290
|
+
rcParams['text.usetex'])
|
|
291
|
+
figure = None
|
|
292
|
+
try:
|
|
293
|
+
figure = self.matplotlib(figsize=figsize)
|
|
294
|
+
figure.set_canvas(FigureCanvasSVG(figure))
|
|
295
|
+
if isinstance(self, GraphicsArray):
|
|
296
|
+
figure.tight_layout()
|
|
297
|
+
buf = BytesIO()
|
|
298
|
+
figure.savefig(buf, format='svg')
|
|
299
|
+
return buf.getvalue()
|
|
300
|
+
finally:
|
|
301
|
+
if figure is not None:
|
|
302
|
+
plt.close(figure)
|
|
303
|
+
(rcParams['ps.useafm'], rcParams['pdf.use14corefonts'],
|
|
304
|
+
rcParams['text.usetex']) = rc_backup
|
|
305
|
+
|
|
241
306
|
def _render_png_(self, **kwds):
|
|
242
307
|
r"""
|
|
243
308
|
Render this graphics array to PNG bytes.
|
|
@@ -712,8 +777,11 @@ class MultiGraphics(WithEqualityById, SageObject):
|
|
|
712
777
|
and dm.preferences.graphics != 'disable'):
|
|
713
778
|
try:
|
|
714
779
|
if _running_in_notebook():
|
|
715
|
-
from IPython.display import display, Image
|
|
716
|
-
|
|
780
|
+
from IPython.display import display, SVG, Image
|
|
781
|
+
try:
|
|
782
|
+
display(SVG(self._render_svg_(**kwds).decode('utf-8')))
|
|
783
|
+
except Exception:
|
|
784
|
+
display(Image(self._render_png_(**kwds)))
|
|
717
785
|
return
|
|
718
786
|
except Exception:
|
|
719
787
|
pass
|
|
@@ -18,6 +18,7 @@ Plotting primitives
|
|
|
18
18
|
#
|
|
19
19
|
# http://www.gnu.org/licenses/
|
|
20
20
|
#*****************************************************************************
|
|
21
|
+
import sage.structure.element # break Cython circular import (refs #1604)
|
|
21
22
|
from sage.misc.fast_methods import WithEqualityById
|
|
22
23
|
from sage.structure.sage_object import SageObject
|
|
23
24
|
from sage.misc.verbose import verbose
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
10.8.4
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/passagemath_plot.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/ext_data/threejs/threejs-version.txt
RENAMED
|
File without changes
|
{passagemath_plot-10.8.4 → passagemath_plot-10.8.5}/sage/ext_data/threejs/threejs_template.html
RENAMED
|
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
|
|
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
|
|
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
|
|
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
|