Esempio n. 1
0
def show(x, *args, **kwds):
    r"""
    Show a graphics object x.

    For additional ways to show objects in the notebook, look
    at the methods on the html object.  For example,
    html.table will produce an HTML table from a nested
    list.


    OPTIONAL INPUT:
    
    
    -  ``filename`` - (default: None) string
    
    
    SOME OF THESE MAY APPLY:

    - ``dpi`` - dots per inch

    - ``figsize``- [width, height] (same for square aspect)

    - ``axes`` - (default: True)

    - ``fontsize`` - positive integer

    - ``frame`` - (default: False) draw a MATLAB-like frame around the
      image
    
    EXAMPLES::
    
        sage: show(graphs(3))
        sage: show(list(graphs(3)))
    """
    if not isinstance(x, (sage.interfaces.expect.Expect, sage.interfaces.expect.ExpectElement)):
        try:
            return x.show(*args, **kwds)
        except AttributeError:
            pass
    if isinstance(x, sage.interfaces.mathematica.MathematicaElement):
        return x.show(*args, **kwds)

    import types

    if isinstance(x, types.GeneratorType):
        x = list(x)
    if isinstance(x, list):
        if len(x) > 0:
            from sage.graphs.graph import GenericGraph

            if isinstance(x[0], GenericGraph):
                import sage.graphs.graph_list as graphs_list

                graphs_list.show_graphs(x)
                return
    _do_show(x)
Esempio n. 2
0
def show(x, *args, **kwds):
    r"""
    Show a graphics object x.

    For additional ways to show objects in the notebook, look
    at the methods on the html object.  For example,
    html.table will produce an HTML table from a nested
    list.


    OPTIONAL INPUT:


    -  ``filename`` - (default: None) string


    SOME OF THESE MAY APPLY:

    - ``dpi`` - dots per inch

    - ``figsize``- [width, height] (same for square aspect)

    - ``axes`` - (default: True)

    - ``fontsize`` - positive integer

    - ``frame`` - (default: False) draw a MATLAB-like frame around the
      image

    EXAMPLES::

        sage: show(graphs(3))
        sage: show(list(graphs(3)))
    """
    if not isinstance(
            x,
        (sage.interfaces.expect.Expect, sage.interfaces.expect.ExpectElement)):
        try:
            return x.show(*args, **kwds)
        except AttributeError:
            pass
    if isinstance(x, sage.interfaces.mathematica.MathematicaElement):
        return x.show(*args, **kwds)

    import types
    if isinstance(x, types.GeneratorType):
        x = list(x)
    if isinstance(x, list):
        if len(x) > 0:
            from sage.graphs.graph import GenericGraph
            if isinstance(x[0], GenericGraph):
                import sage.graphs.graph_list as graphs_list
                graphs_list.show_graphs(x)
                return
    _do_show(x)