Did I find the right examples for you? yes no

All Samples(34)  |  Call(32)  |  Derive(0)  |  Import(2)
Given a :class:`Diagram` and the corresponding
:class:`DiagramGrid`, produces the Xy-pic representation of the
diagram.

The most important method in this class is ``draw``.  Consider the
following triangle diagram:

>>> from sympy.categories import Object, NamedMorphism, Diagram
>>> from sympy.categories import DiagramGrid, XypicDiagramDrawer
>>> A = Object("A")(more...)

src/s/y/sympy-0.7.5/sympy/categories/tests/test_drawing.py   sympy(Download)
from sympy.categories.diagram_drawing import _GrowableGrid, ArrowStringDescription
from sympy.categories import (DiagramGrid, Object, NamedMorphism,
                              Diagram, XypicDiagramDrawer, xypic_draw_diagram)
from sympy import FiniteSet
 
    d = Diagram([f, g, h, i])
    grid = DiagramGrid(d, layout="sequential")
    drawer = XypicDiagramDrawer()
    assert drawer.draw(d, grid) == "\\xymatrix{\n" \
        "A \\ar[r]^{f} & B \\ar[r]^{g} & C \\ar[r]^{h} & D \\ar[r]^{i} & E \n" \
        "}\n"
 
    # The same diagram, transposed.
    grid = DiagramGrid(d, layout="sequential", transpose=True)
    drawer = XypicDiagramDrawer()
    d = Diagram([f, g], {g * f: "unique"})
    grid = DiagramGrid(d)
    drawer = XypicDiagramDrawer()
    assert drawer.draw(d, grid) == "\\xymatrix{\n" \
        "A \\ar[d]_{g\\circ f} \\ar[r]^{f} & B \\ar[ld]^{g} \\\\\n" \
    # The same diagram, transposed.
    grid = DiagramGrid(d, transpose=True)
    drawer = XypicDiagramDrawer()
    assert drawer.draw(d, grid) == "\\xymatrix{\n" \
        "A \\ar[r]^{g\\circ f} \\ar[d]_{f} & C \\\\\n" \

src/s/y/sympy-HEAD/sympy/categories/tests/test_drawing.py   sympy(Download)
from sympy.categories.diagram_drawing import _GrowableGrid, ArrowStringDescription
from sympy.categories import (DiagramGrid, Object, NamedMorphism,
                              Diagram, XypicDiagramDrawer, xypic_draw_diagram)
from sympy import FiniteSet
 
    d = Diagram([f, g, h, i])
    grid = DiagramGrid(d, layout="sequential")
    drawer = XypicDiagramDrawer()
    assert drawer.draw(d, grid) == "\\xymatrix{\n" \
        "A \\ar[r]^{f} & B \\ar[r]^{g} & C \\ar[r]^{h} & D \\ar[r]^{i} & E \n" \
        "}\n"
 
    # The same diagram, transposed.
    grid = DiagramGrid(d, layout="sequential", transpose=True)
    drawer = XypicDiagramDrawer()
    d = Diagram([f, g], {g * f: "unique"})
    grid = DiagramGrid(d)
    drawer = XypicDiagramDrawer()
    assert drawer.draw(d, grid) == "\\xymatrix{\n" \
        "A \\ar[d]_{g\\circ f} \\ar[r]^{f} & B \\ar[ld]^{g} \\\\\n" \
    # The same diagram, transposed.
    grid = DiagramGrid(d, transpose=True)
    drawer = XypicDiagramDrawer()
    assert drawer.draw(d, grid) == "\\xymatrix{\n" \
        "A \\ar[r]^{g\\circ f} \\ar[d]_{f} & C \\\\\n" \