PyChart Reference Manual

Node:Unit, Next:chart_data, Previous:Attributes, Up:Top

## Unit of length and the coordinate System

In PyChart, the X axis grows to the right, and the Y axis grows up (the same as Postscript, but different from X and Windows).

Lengths are measured by "Postscript points", which coincides with TeX points. One point is equal to 1/72 inch. Several variables and functions are provided to manipulate lengths:

theme.scale_factor | Variable

Defines chart magnification. The default value is 1.0, meaning that one point actually means one Postscript point. Setting this value to 3.0, for example, makes PyChart draw everything three times larger.

area.x_pos XVAL | Function

Converts X XVAL to a coordinate on the canvas (see canvas).

area.y_pos YVAL | Function

Converts Y YVAL to a coordinate on the canvas (see canvas).

    ar = area.T(loc=(50, 50), size=(100, 100),
                xrange=(0,200), yrange=(0, 1000))
    px = ar.x_pos(50)
    py = ar.y_pos(100)

In the above example, the chart is drawn on the area defined by rectangle (50, 50) - (150, 150). The point (`px, py`) will be at (75, 60), which is the screen location at which the point (50, 100) would be drawn (i.e., 50 + 100 * 50/200 = 75, 50 + 100 * 100 / 1000 = 60).