Skip to content

Commit d8970e8

Browse files
author
Release Manager
committed
sagemathgh-39465: remove deprecated stuff in polyhedron plot found using the scripts in sagemath#39262 ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. URL: sagemath#39465 Reported by: Frédéric Chapoton Reviewer(s): David Coudert
2 parents d0295c9 + 82f5890 commit d8970e8

File tree

1 file changed

+28
-29
lines changed
  • src/sage/geometry/polyhedron

1 file changed

+28
-29
lines changed

src/sage/geometry/polyhedron/plot.py

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ def __init__(self, polyhedron, proj=projection_func_identity):
390390

391391
self(proj)
392392

393-
def _repr_(self):
393+
def _repr_(self) -> str:
394394
"""
395395
Return a string describing the projection.
396396
@@ -1234,7 +1234,7 @@ def render_3d(self, point_opts=None, line_opts=None, polygon_opts=None):
12341234
def tikz(self, view=[0, 0, 1], angle=0, scale=1,
12351235
edge_color='blue!95!black', facet_color='blue!95!black',
12361236
opacity=0.8, vertex_color='green', axis=False,
1237-
output_type=None):
1237+
output_type='TikzPicture'):
12381238
r"""
12391239
Return a tikz picture of ``self`` as a string or as a
12401240
:class:`~sage.misc.latex_standalone.TikzPicture`
@@ -1256,8 +1256,8 @@ def tikz(self, view=[0, 0, 1], angle=0, scale=1,
12561256
- ``opacity`` -- real number (default: 0.8) between 0 and 1 giving the opacity of
12571257
the front facets
12581258
- ``axis`` -- boolean (default: ``False``); draw the axes at the origin or not
1259-
- ``output_type`` -- string (default: ``None``); valid values
1260-
are ``None`` (deprecated), ``'LatexExpr'`` and ``'TikzPicture'``,
1259+
- ``output_type`` -- string (default: ``'TikzPicture'``); valid values
1260+
are ``'LatexExpr'`` and ``'TikzPicture'``,
12611261
whether to return a :class:`LatexExpr` object (which inherits from Python
12621262
:class:`str`) or a :class:`TikzPicture` object from module
12631263
:mod:`sage.misc.latex_standalone`
@@ -1372,8 +1372,7 @@ def tikz(self, view=[0, 0, 1], angle=0, scale=1,
13721372
sage: Image3 = P3.projection().tikz([0.5, -1, -0.1], 55, scale=3,
13731373
....: edge_color='blue!95!black',
13741374
....: facet_color='orange!95!black', opacity=0.7,
1375-
....: vertex_color='yellow', axis=True,
1376-
....: output_type='TikzPicture')
1375+
....: vertex_color='yellow', axis=True)
13771376
sage: Image3
13781377
\documentclass[tikz]{standalone}
13791378
\begin{document}
@@ -1406,6 +1405,15 @@ def tikz(self, view=[0, 0, 1], angle=0, scale=1,
14061405
...
14071406
NotImplementedError: The polytope has to live in 2 or 3 dimensions.
14081407
1408+
TESTS::
1409+
1410+
sage: P = Polyhedron(vertices=[[0,0,0], [1,0,0],
1411+
....: [0,0,1], [0,1,0]])
1412+
sage: P.projection().tikz(output_type='kawai')
1413+
Traceback (most recent call last):
1414+
...
1415+
ValueError: output_type (='kawai') must be 'LatexExpr' or 'TikzPicture'
1416+
14091417
.. TODO::
14101418
14111419
Make it possible to draw Schlegel diagram for 4-polytopes. ::
@@ -1425,39 +1433,30 @@ def tikz(self, view=[0, 0, 1], angle=0, scale=1,
14251433
elif self.polyhedron_dim < 2 or self.polyhedron_dim > 3:
14261434
raise NotImplementedError("The polytope has to be 2 or 3-dimensional.")
14271435
elif self.polyhedron_ambient_dim == 2: # self is a polygon in 2-space
1428-
tikz_string = self._tikz_2d(scale, edge_color, facet_color, opacity,
1429-
vertex_color, axis)
1436+
tikz_string = self._tikz_2d(scale, edge_color,
1437+
facet_color, opacity,
1438+
vertex_color, axis)
14301439
elif self.polyhedron_dim == 2: # self is a polygon in 3-space
14311440
tikz_string = self._tikz_2d_in_3d(view, angle, scale, edge_color,
1432-
facet_color, opacity, vertex_color, axis)
1441+
facet_color, opacity,
1442+
vertex_color, axis)
14331443
else: # self is a 3-polytope in 3-space
14341444
tikz_string = self._tikz_3d_in_3d(view, angle, scale, edge_color,
1435-
facet_color, opacity, vertex_color, axis)
1436-
1437-
# set default value
1438-
if output_type is None:
1439-
from sage.misc.superseded import deprecation
1440-
msg = ("The default type of the returned object will soon be "
1441-
"changed from `sage.misc.latex.LatexExpr` to "
1442-
"`sage.misc.latex_standalone.TikzPicture`. Please "
1443-
"update your code to specify the desired output type as "
1444-
"`.tikz(output_type='LatexExpr')` to keep the old "
1445-
"behavior or `.tikz(output_type='TikzPicture')` to use "
1446-
"the future default behavior.")
1447-
deprecation(33002, msg)
1448-
output_type = 'LatexExpr'
1445+
facet_color, opacity,
1446+
vertex_color, axis)
14491447

14501448
# return
14511449
if output_type == 'LatexExpr':
14521450
return tikz_string
1453-
elif output_type == 'TikzPicture':
1451+
1452+
if output_type == 'TikzPicture':
14541453
from sage.misc.latex_standalone import TikzPicture
14551454
return TikzPicture(tikz_string, standalone_config=None,
1456-
usepackage=None, usetikzlibrary=None, macros=None,
1457-
use_sage_preamble=False)
1458-
else:
1459-
raise ValueError("output_type (='{}') must be 'LatexExpr' or"
1460-
" 'TikzPicture'".format(output_type))
1455+
usepackage=None, usetikzlibrary=None,
1456+
macros=None, use_sage_preamble=False)
1457+
1458+
raise ValueError("output_type (='{}') must be 'LatexExpr' or"
1459+
" 'TikzPicture'".format(output_type))
14611460

14621461
def _tikz_2d(self, scale, edge_color, facet_color, opacity, vertex_color, axis):
14631462
r"""

0 commit comments

Comments
 (0)