def assign_visual_mapping(data, aes, gg):
    legend = {}
    data, legend['color'] = colors.assign_colors(data, aes, gg, 'color')
    data, legend['fill'] = colors.assign_colors(data, aes, gg, 'fill')
    data, legend['size'] = size.assign_sizes(data, aes)
    data, legend['linetype'] = linetypes.assign_linetypes(data, aes)
    data, legend['shape'] = shapes.assign_shapes(data, aes)
    data, legend['alpha'] = alphas.assign_alphas(data, aes)

    # Delete empty entries in the legend
    for _aes_name in ('color', 'fill', 'size', 'linetype', 'shape', 'alpha'):
        if not legend[_aes_name]:
            del legend[_aes_name]

    return data, legend
Assigns the visual mapping to the given data and adds the right legend
dataset/ETHPy150Open yhat/ggplot/ggplot/components/__init__.py/assign_visual_mapping