in python-package/lets_plot/bistro/_plot2d_common.py [0:0]
def _get_geom2d_layer(geom_kind, binwidth2d, bins2d, color, color_by, size, alpha, show_legend):
if geom_kind == 'point':
return geom_point(color=color, size=size, alpha=alpha, show_legend=show_legend)
if geom_kind == 'tile':
return geom_bin2d(
aes(fill=('..count..' if color_by is None else color_by)),
bins=bins2d, binwidth=binwidth2d,
color=color, size=size, alpha=alpha,
show_legend=show_legend
)
if geom_kind == 'hex':
return geom_hex(
aes(fill=('..count..' if color_by is None else color_by)),
bins=bins2d, binwidth=binwidth2d,
color=color, size=size, alpha=alpha,
show_legend=show_legend
)
if geom_kind == 'density2d':
return geom_density2d(
aes(color=('..group..' if color_by is None else color_by)),
color=color, size=size, alpha=alpha,
show_legend=show_legend
)
if geom_kind == 'density2df':
return geom_density2df(
aes(fill=('..group..' if color_by is None else color_by)),
color=color, size=size, alpha=alpha,
show_legend=show_legend
)
if geom_kind == 'pointdensity':
return geom_pointdensity(
aes(color=('..density..' if color_by is None else color_by)),
color=color, size=size, alpha=alpha,
show_legend=show_legend
)
if geom_kind == 'none':
return None
raise Exception("Unknown geom '{0}'".format(geom_kind))