Example #1
0
def draw_name(name, location):
    """Draw the two-letter postal code at the center of the state.

    location -- a position
    """
    center = position_to_xy(location)
    get_canvas().draw_text(name.upper(), center, anchor='center', style='bold')
Example #2
0
def draw_name(name, location):
    """Draw the two-letter postal code at the center of the state.

    location -- a position
    """
    center = position_to_xy(location)
    get_canvas().draw_text(name.upper(), center, anchor='center', style='bold')
Example #3
0
def draw_dot(location, sentiment_value=None, radius=3):
    """Draw a small dot at location.

    location -- a position
    sentiment_value -- a number between -1 (negative) and 1 (positive)
    """
    center = position_to_xy(location)
    color = get_sentiment_color(sentiment_value)
    get_canvas().draw_circle(center, radius, fill_color=color)
Example #4
0
def draw_dot(location, sentiment_value=None, radius=3):
    """Draw a small dot at location.

    location -- a position
    sentiment_value -- a number between -1 (negative) and 1 (positive)
    """
    center = position_to_xy(location)
    color = get_sentiment_color(sentiment_value)
    get_canvas().draw_circle(center, radius, fill_color=color)
Example #5
0
def draw_dot(location, frequency_value=None, radius=3):
    """Draw a small dot at location.

    location -- a position
    frequency_value -- a number between 0 and 1 (positive)
    """
    center = position_to_xy(location)
    color = get_frequency_color(frequency_value)
    get_canvas().draw_circle(center, radius, fill_color=color)
Example #6
0
def draw_state(shapes, sentiment_value=None):
    """Draw the named state in the given color on the canvas.

    state -- a list of list of polygons (which are lists of positions)
    sentiment_value -- a number between -1 (negative) and 1 (positive)
    canvas -- the graphics.Canvas object
    """
    for polygon in shapes:
        vertices = [position_to_xy(position) for position in polygon]
        color = get_sentiment_color(sentiment_value)
        get_canvas().draw_polygon(vertices, fill_color=color)
Example #7
0
def draw_state(shapes, sentiment_value=None):
    """Draw the named state in the given color on the canvas.

    state -- a list of list of polygons (which are lists of positions)
    sentiment_value -- a number between -1 (negative) and 1 (positive)
    canvas -- the graphics.Canvas object
    """
    for polygon in shapes:
        vertices = [position_to_xy(position) for position in polygon]
        color = get_sentiment_color(sentiment_value)
        get_canvas().draw_polygon(vertices, fill_color=color)