In [2]:
from lets_plot import *

LetsPlot.setup_html()
In [6]:
dat = dict(
    x = [0, 2],
    y = [0, 2],
    c = ["a", "b"],
    s = ["a", "b"]
)

p = ggplot(dat) + geom_point(aes("x", "y", shape="s", color="c"), size=10)
p
Out[6]:
In [10]:
p + scale_color_manual(name="O", values=["red", "blue"]) #+ scale_shape(name="O")
Out[10]:
In [13]:
p1 = ggplot(dat) + geom_tile(aes("x", "y", fill="c"))
p1
Out[13]:
In [15]:
p1 + scale_fill_manual(name="O", values=["red", "blue"], labels=['No', 'Yes'])
Out[15]:
In [25]:
dat2 = dict(
    x = ["a", "a", "b"],
)


(ggplot(dat2) + 
 geom_bar(aes("x", fill="x")) + 
 scale_fill_manual(name="O", values=["red", "blue"], labels=['No', 'Yes'])
)
Out[25]:
In [24]:
from lets_plot.mapping import as_discrete


(ggplot(dat2) + 
 geom_bar(aes("x", fill=as_discrete("x"))) + 
 scale_fill_manual(name="O", values=["red", "blue"], labels=['No', 'Yes'])
)
Out[24]:
In [ ]: