Changes between Initial Version and Version 17 of Ticket #14175


Ignore:
Timestamp:
03/02/13 07:49:38 (9 years ago)
Author:
vbraun
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #14175

    • Property Status changed from new to needs_review
    • Property Reviewers changed from Volker Braun? to Volker Braun
    • Property Authors changed from Nicolas M. Thiéry to Volker Braun, Nicolas M. Thiéry
    • Property Summary changed from Fix color option for 2D polyhedron to More plot options for polytopes
  • Ticket #14175 – Description

    initial v17  
    1 Currently, the color option for ploting 2D polyhedron triggers a warning::
     1This ticket implements plot options to control the graphical display of polygons:
    22{{{
    3 sage: p1 = Polyhedron(vertices=[[1,1]], rays=[[1,1]])
    4 sage: p1.plot(color="red")
    5 verbose 0 (138: primitive.py, options) WARNING: Ignoring option 'color'=red
    6 verbose 0 (138: primitive.py, options)
    7 The allowed options for Polygon defined by 3 points are:
    8     alpha          How transparent the figure is.                             
    9     fill           Whether or not to fill the polygon.                         
    10     hue            The color given as a hue.                                   
    11     legend_label   The label for this item in the legend.                     
    12     rgbcolor       The color as an RGB tuple.                                 
    13     thickness      How thick the border line is.                               
    14     zorder         The layer level in which to draw                           
     3    def plot(self,
     4             point={}, line={}, polygon={},
     5             wireframe={}, fill={},
     6             **kwds):
     7        """
     8        Return a graphical representation.
     9
     10        INPUT:
     11
     12        - ``point``, ``line``, ``polygon`` -- Parameters to pass to
     13          point (0d), line (1d), and polygon (2d) plot
     14          commands. Allowed values are
     15
     16          * Python dictionary: Passed as keywords to the plot
     17            commands.
     18
     19          * String or triple of numbers: The color. This is equivalent
     20            to passing the dictionary ``{'color':...}``.
     21         
     22          * ``None`` or ``False``: Switch off drawing of the
     23            corresponding graphics options.
     24
     25        - ``wireframe``, ``fill`` -- Similar to ``point`` / ``line`` /
     26          ``polygon``, but ``fill`` is used for the graphics objects
     27          in the dimension of the polytope and ``wireframe`` is used
     28          for all lower-dimensional graphics objects.
     29
     30        - ``**kwds`` -- optional keyword parameters that are passed to
     31          all graphics objectcs.
     32
     33        OUTPUT:
     34
     35        A graphics object.
     36
     37        TESTS::
     38
     39            sage: square = polytopes.n_cube(2)
     40            sage: plt = square.plot()
     41            sage: for p in plt:
     42            ...       print p.options()['rgbcolor'], p
     43            (0, 0, 1) Point set defined by 4 point(s)
     44            (0, 0, 1) Line defined by 2 points
     45            (0, 0, 1) Line defined by 2 points
     46            (0, 0, 1) Line defined by 2 points
     47            (0, 0, 1) Line defined by 2 points
     48            (0, 1, 0) Polygon defined by 4 points
     49
     50        Draw the lines in red and nothing else::
     51
     52            sage: plt = square.plot(point=None, line='red', polygon=False)
     53            sage: for p in plt:
     54            ...       print p.options()['rgbcolor'], p
     55            red Line defined by 2 points
     56            red Line defined by 2 points
     57            red Line defined by 2 points
     58            red Line defined by 2 points
     59
     60        Draw vertices in red, no lines, and a blue polygon::
     61
     62            sage: plt = square.plot(point={'color':'red'}, line=False, fill=(0,0,1))
     63            sage: for p in plt:
     64            ...       print p.options()['rgbcolor'], p
     65            red Point set defined by 4 point(s)
     66            (0, 0, 1) Polygon defined by 4 points
     67        """
    1568}}}
    16 
    17 The attached patch fixes this.