from lets_plot import *
LetsPlot.setup_html()
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
p + scale_color_manual(name="O", values=["red", "blue"]) #+ scale_shape(name="O")
p1 = ggplot(dat) + geom_tile(aes("x", "y", fill="c"))
p1
p1 + scale_fill_manual(name="O", values=["red", "blue"], labels=['No', 'Yes'])
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'])
)
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'])
)