In [ ]:
from lets_plot import *
import numpy as np
LetsPlot.setup_html()
In [ ]:
def f(x, y):
    return x * y

x = np.arange(1, 11, 1)
y = np.arange(1, 11, 1)
X, Y = np.meshgrid(x, y)

df = dict(
    x = X.reshape(-1),
    y = Y.reshape(-1),
    value = f(X, Y).reshape(-1)
)
In [ ]:
p1 = ggplot(df, aes('x', 'y')) + geom_tile(aes(fill = 'value'))
In [ ]:
# Basic form

p1 + scale_fill_continuous(guide = "colorbar")
In [ ]:
p1 + scale_fill_continuous(guide = guide_colorbar())
In [ ]:
p1 + guides(fill = guide_colorbar())
In [ ]:
# Remove guide

p1 + scale_fill_continuous(guide = 'none')
In [ ]:
p1 + guides(fill = 'none')
In [ ]:
# Control styles

p1 + scale_fill_continuous(guide = guide_colorbar(barwidth = 10))
In [ ]:
p1 + guides(fill = guide_colorbar(barwidth = 10))
In [ ]:
p1 + scale_fill_continuous(limits = [0,20], breaks = [0, 5, 10, 15, 20], guide = guide_colorbar(nbin=5))
In [ ]:
p2 = p1 + geom_point(aes(size = 'value'))
p2
In [ ]:
p2 + guides(size = guide_legend(nrow=3), fill = guide_colorbar(nbin = 8))
In [ ]:
# independent guides control
(
    p2 
    + scale_size(guide = guide_legend(nrow=3))
    + scale_fill_continuous(guide = guide_colorbar(nbin = 8)) 
)
In [ ]:
(
    p2 
    + scale_size(guide = guide_legend(nrow=3))
    + guides(fill = guide_colorbar(nbin = 8))
)