# Module Scientific.TkWidgets.TkPlotCanvas

## Class PolyLine: Multiple connected lines

Constructor: PolyLine(points, **|attr|)

points

  any sequence of (x, y) number pairs

attr

  line attributes specified by keyword arguments:

  - `width`: the line width (default: 1)

  - `color`: a string whose value is one of the color names defined in Tk (default: "black")

  - `stipple`: a string whose value is the name of a bitmap defined in Tk, or `None` for no bitmap (default: `None`)

## Class PolyMarker: Series of markers

Constructor: PolyPoints(points, **|attr|)

points

  any sequence of (x, y) number pairs

attr marker attributes specified by keyword arguments:

- `width`: the line width for drawing the marker (default: 1)

- `color`: a string whose value is one of the color names defined in Tk, defines the color of the line forming the marker (default: black)

- `fillcolor`: a string whose value is one of the color names defined in Tk, defines the color of the interior of the marker (default: black)

- `marker`: one of `circle` (default), `dot`, `square`, `triangle`, `triangle_down`, `cross`, `plus`

## Class PlotGraphics: Compound graphics object

Constructor: PlotGraphics(objects)

objects

  a list whose elements can be instances of the classes PolyLine, PolyPoint, and PlotGraphics.

## Class PlotCanvas: Tk plot widget

Constructor: PlotCanvas(master, width, height, **|attributes|).

The arguments have the same meaning as for a standard Tk canvas. The default background color is white and the default font is Helvetica at 10 points.

PlotCanvas objects support all operations of Tk widgets.

There are two attributes in addition to the standard Tk attributes:

zoom

  a logical variable that indicates whether interactive zooming (using the left mouse button) is enabled; the default is 0 (no zoom)

select

  enables the user to select a range along the x axis by dragging the mouse (with the left button pressed) in the area under the x axis. If select is 0, no selection is possible. Otherwise the value of select must be a callable object that is called whenever the selection changes, with a single argument that can be None (no selection) or a tuple containing two x values.

Methods:

- draw(graphics, xaxis=`None`, yaxis=`None`)

  Draws the graphics object graphics, which can be a PolyLine, PolyMarker, or PlotGraphics object. The arguments xaxis and yaxis specify how axes are drawn: `None` means that no axis is drawn and the graphics objects are scaled to fill the canvas optimally. `"automatic"` means that the axis is drawn and a suitable value range is determined automatically. A sequence of two numbers means that the axis is drawn and the value range is the interval specified by the two numbers.

- clear()

  Clears the canvas.

- redraw()

  Redraws the last canvas contents.

- select(range)

  Shows the given range as highlighted. range can be None (no selection) or a sequence of two values on the x-axis.