crop_yield_prediction/plot/plot_crop_yield.py [31:64]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    soup = BeautifulSoup(svg, features="html.parser")
    # Find counties
    paths = soup.findAll('path')

    path_style = 'font-size:12px;fill-rule:nonzero;stroke:#FFFFFF;stroke-opacity:1;stroke-width:0.1' \
                 ';stroke-miterlimit:4;stroke-dasharray:none;stroke-linecap:butt;marker-start' \
                 ':none;stroke-linejoin:bevel;fill:'

    for p in paths:
        if p['id'] not in ["State_Lines", "separator"]:
            try:
                rate = data_dict[p['id']]
            except KeyError:
                continue
            if rate > quantiles[0.95]:
                color_class = 6
            elif rate > quantiles[0.8]:
                color_class = 5
            elif rate > quantiles[0.6]:
                color_class = 4
            elif rate > quantiles[0.4]:
                color_class = 3
            elif rate > quantiles[0.2]:
                color_class = 2
            elif rate > quantiles[0.05]:
                color_class = 1
            else:
                color_class = 0

            color = colors[color_class]
            p['style'] = path_style + color
    soup = soup.prettify()
    with savepath.open('w') as f:
        f.write(soup)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



data_preprocessing/plot/counties_plot.py [29:62]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    soup = BeautifulSoup(svg, features="html.parser")
    # Find counties
    paths = soup.findAll('path')

    path_style = 'font-size:12px;fill-rule:nonzero;stroke:#FFFFFF;stroke-opacity:1;stroke-width:0.1' \
                 ';stroke-miterlimit:4;stroke-dasharray:none;stroke-linecap:butt;marker-start' \
                 ':none;stroke-linejoin:bevel;fill:'

    for p in paths:
        if p['id'] not in ["State_Lines", "separator"]:
            try:
                rate = data_dict[p['id']]
            except KeyError:
                continue
            if rate > quantiles[0.95]:
                color_class = 6
            elif rate > quantiles[0.8]:
                color_class = 5
            elif rate > quantiles[0.6]:
                color_class = 4
            elif rate > quantiles[0.4]:
                color_class = 3
            elif rate > quantiles[0.2]:
                color_class = 2
            elif rate > quantiles[0.05]:
                color_class = 1
            else:
                color_class = 0

            color = colors[color_class]
            p['style'] = path_style + color
    soup = soup.prettify()
    with savepath.open('w') as f:
        f.write(soup)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



