Color Key APIΒΆ

The constructor takes a list of strings and creates a Color_Key object for those strings.

def get_color(self, tag):
'''
Given a tag, return the corresponding color.
If the tag is not in set of known tags,
then return the default color (gray).

Inputs:
    tag: string

Returns: color
'''


def draw_color_key(self, canvas, x0, y0, x1, y1)
'''
Draw the color key in the specified rectangle ((x0, y0), (x1, y1)).

Inputs:
    canvas: ChiCanvas object
    x0, y0, x1, y1: floats with coordinates for points (x0, y0)
        and (x1, y1)
'''