Chi Canvas APIΒΆ
The constructor takes x and y scale factors and a title and and
creates a ChiCanvas
object.
def draw_rectangle(self, x0, y0, x1, y1, fill='blue', outline='black')
'''
Draw a rectangle defined by the location of its opposing corners
((x0,y0) and (x1, y1)).
Inputs:
x0, y0, x1, y1: floats with coordinates for points (x0, y0)
(x1, y1)
fill: color for the fill
outline: color for the outline
Outputs: draws a rectangle
'''
def draw_text(self,x0,y0,width,txt,fg="black",debug=False):
'''
Draw text horizontally in a box. The text will be clipped
(truncated) if it is too long to fit in the box.
Inputs:
x0, y0: (floats) (x0, y0) is the center of a box
width: (float) width of the box
txt: the text to write
fg: (color) optional color for the text
debug: optional flag.
Outputs: draws text
'''
def draw_text_vertical(self, x0, y0, h, txt, fg="black", debug=False)
'''
Draw text vertically. Same as draw_text, except the text is
rotated 90 degrees and the height of the box is specified rather
than the width.
'''
def show(self)
'''
Show the figure
'''
def savefig(self,filename)
'''
Save the figure in the specified file.
'''