def xyplot(points, title="", c="b", corner=1, lines=False):
    """
    Return a ``vtkXYPlotActor`` that is a plot of `x` versus `y`,
    where `points` is a list of `(x,y)` points.

    :param int corner: assign position:

        - 1, topleft,

        - 2, topright,

        - 3, bottomleft,

        - 4, bottomright.

    .. hint:: Example: |fitspheres1.py|_
    """
    c = vc.getColor(c)  # allow different codings
    array_x = vtk.vtkFloatArray()
    array_y = vtk.vtkFloatArray()
    array_x.SetNumberOfTuples(len(points))
    array_y.SetNumberOfTuples(len(points))
    for i, p in enumerate(points):
        array_x.InsertValue(i, p[0])
        array_y.InsertValue(i, p[1])
    field = vtk.vtkFieldData()
    field.AddArray(array_x)
    field.AddArray(array_y)
    data = vtk.vtkDataObject()
    data.SetFieldData(field)
    plot = vtk.vtkXYPlotActor()
    plot.AddDataObjectInput(data)
    plot.SetDataObjectXComponent(0, 0)
    plot.SetDataObjectYComponent(0, 1)
    plot.SetXValuesToValue()
    plot.SetXTitle(title)
    plot.SetYTitle("")
    plot.ExchangeAxesOff()
    plot.PlotPointsOn()
    if not lines:
        plot.PlotLinesOff()
    plot.GetProperty().SetPointSize(5)
    plot.GetProperty().SetLineWidth(2)
    plot.SetNumberOfXLabels(3)  # not working
    plot.GetProperty().SetColor(0, 0, 0)
    plot.GetProperty().SetOpacity(0.7)
    plot.SetPlotColor(0, c[0], c[1], c[2])
    tprop = plot.GetAxisLabelTextProperty()
    tprop.SetColor(0, 0, 0)
    tprop.SetOpacity(0.7)
    tprop.SetFontFamily(0)
    tprop.BoldOff()
    tprop.ItalicOff()
    tprop.ShadowOff()
    tprop.SetFontSize(3)  # not working
    plot.SetAxisTitleTextProperty(tprop)
    plot.SetAxisLabelTextProperty(tprop)
    plot.SetTitleTextProperty(tprop)
    if corner == 1:
        plot.GetPositionCoordinate().SetValue(0.0, 0.8, 0)
    if corner == 2:
        plot.GetPositionCoordinate().SetValue(0.7, 0.8, 0)
    if corner == 3:
        plot.GetPositionCoordinate().SetValue(0.0, 0.0, 0)
    if corner == 4:
        plot.GetPositionCoordinate().SetValue(0.7, 0.0, 0)
    plot.GetPosition2Coordinate().SetValue(0.3, 0.2, 0)
    return plot
def xyplot ( points , title = "" , c = "b" , corner = 1 , lines = False ) : c = vc . getColor ( c ) array_x = vtk . vtkFloatArray ( ) array_y = vtk . vtkFloatArray ( ) array_x . SetNumberOfTuples ( len ( points ) ) array_y . SetNumberOfTuples ( len ( points ) ) for i , p in enumerate ( points ) : array_x . InsertValue ( i , p [ 0 ] ) array_y . InsertValue ( i , p [ 1 ] ) field = vtk . vtkFieldData ( ) field . AddArray ( array_x ) field . AddArray ( array_y ) data = vtk . vtkDataObject ( ) data . SetFieldData ( field ) plot = vtk . vtkXYPlotActor ( ) plot . AddDataObjectInput ( data ) plot . SetDataObjectXComponent ( 0 , 0 ) plot . SetDataObjectYComponent ( 0 , 1 ) plot . SetXValuesToValue ( ) plot . SetXTitle ( title ) plot . SetYTitle ( "" ) plot . ExchangeAxesOff ( ) plot . PlotPointsOn ( ) if not lines : plot . PlotLinesOff ( ) plot . GetProperty ( ) . SetPointSize ( 5 ) plot . GetProperty ( ) . SetLineWidth ( 2 ) plot . SetNumberOfXLabels ( 3 ) plot . GetProperty ( ) . SetColor ( 0 , 0 , 0 ) plot . GetProperty ( ) . SetOpacity ( 0.7 ) plot . SetPlotColor ( 0 , c [ 0 ] , c [ 1 ] , c [ 2 ] ) tprop = plot . GetAxisLabelTextProperty ( ) tprop . SetColor ( 0 , 0 , 0 ) tprop . SetOpacity ( 0.7 ) tprop . SetFontFamily ( 0 ) tprop . BoldOff ( ) tprop . ItalicOff ( ) tprop . ShadowOff ( ) tprop . SetFontSize ( 3 ) plot . SetAxisTitleTextProperty ( tprop ) plot . SetAxisLabelTextProperty ( tprop ) plot . SetTitleTextProperty ( tprop ) if corner == 1 : plot . GetPositionCoordinate ( ) . SetValue ( 0.0 , 0.8 , 0 ) if corner == 2 : plot . GetPositionCoordinate ( ) . SetValue ( 0.7 , 0.8 , 0 ) if corner == 3 : plot . GetPositionCoordinate ( ) . SetValue ( 0.0 , 0.0 , 0 ) if corner == 4 : plot . GetPositionCoordinate ( ) . SetValue ( 0.7 , 0.0 , 0 ) plot . GetPosition2Coordinate ( ) . SetValue ( 0.3 , 0.2 , 0 ) return plot
Return a ``vtkXYPlotActor`` that is a plot of `x` versus `y`,
    where `points` is a list of `(x,y)` points.

    :param int corner: assign position:

        - 1, topleft,

        - 2, topright,

        - 3, bottomleft,

        - 4, bottomright.

    .. hint:: Example: |fitspheres1.py|_