#14175: More plot options for polytopes
---------------------------------------------------+------------------------
Reporter: nthiery | Owner: mhampton
Type: defect | Status:
needs_review
Priority: major | Milestone: sage-5.8
Component: geometry | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers: Volker
Braun
Authors: Volker Braun, Nicolas M. Thiéry | Merged in:
Dependencies: | Stopgaps:
---------------------------------------------------+------------------------
Changes (by {'newvalue': u'Volker Braun, Nicolas M. Thi\xe9ry', 'oldvalue':
u'Nicolas M. Thi\xe9ry'}):
* reviewer: Volker Braun? => Volker Braun
* author: Nicolas M. Thiéry => Volker Braun, Nicolas M. Thiéry
Old description:
> Currently, the color option for ploting 2D polyhedron triggers a
> warning::
> {{{
> sage: p1 = Polyhedron(vertices=[[1,1]], rays=[[1,1]])
> sage: p1.plot(color="red")
> verbose 0 (138: primitive.py, options) WARNING: Ignoring option
> 'color'=red
> verbose 0 (138: primitive.py, options)
> The allowed options for Polygon defined by 3 points are:
> alpha How transparent the figure is.
> fill Whether or not to fill the polygon.
> hue The color given as a hue.
> legend_label The label for this item in the legend.
> rgbcolor The color as an RGB tuple.
> thickness How thick the border line is.
> zorder The layer level in which to draw
> }}}
>
> The attached patch fixes this.
New description:
This ticket implements plot options to control the graphical display of
polygons:
{{{
def plot(self,
point={}, line={}, polygon={},
wireframe={}, fill={},
**kwds):
"""
Return a graphical representation.
INPUT:
- ``point``, ``line``, ``polygon`` -- Parameters to pass to
point (0d), line (1d), and polygon (2d) plot
commands. Allowed values are
* Python dictionary: Passed as keywords to the plot
commands.
* String or triple of numbers: The color. This is equivalent
to passing the dictionary ``{'color':...}``.
* ``None`` or ``False``: Switch off drawing of the
corresponding graphics options.
- ``wireframe``, ``fill`` -- Similar to ``point`` / ``line`` /
``polygon``, but ``fill`` is used for the graphics objects
in the dimension of the polytope and ``wireframe`` is used
for all lower-dimensional graphics objects.
- ``**kwds`` -- optional keyword parameters that are passed to
all graphics objectcs.
OUTPUT:
A graphics object.
TESTS::
sage: square = polytopes.n_cube(2)
sage: plt = square.plot()
sage: for p in plt:
... print p.options()['rgbcolor'], p
(0, 0, 1) Point set defined by 4 point(s)
(0, 0, 1) Line defined by 2 points
(0, 0, 1) Line defined by 2 points
(0, 0, 1) Line defined by 2 points
(0, 0, 1) Line defined by 2 points
(0, 1, 0) Polygon defined by 4 points
Draw the lines in red and nothing else::
sage: plt = square.plot(point=None, line='red', polygon=False)
sage: for p in plt:
... print p.options()['rgbcolor'], p
red Line defined by 2 points
red Line defined by 2 points
red Line defined by 2 points
red Line defined by 2 points
Draw vertices in red, no lines, and a blue polygon::
sage: plt = square.plot(point={'color':'red'}, line=False,
fill=(0,0,1))
sage: for p in plt:
... print p.options()['rgbcolor'], p
red Point set defined by 4 point(s)
(0, 0, 1) Polygon defined by 4 points
"""
}}}
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14175#comment:17>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.