In [1]:
from lets_plot import *
LetsPlot.setup_html()
In [2]:
data = {'x': list(range(-32, 32))}

p = ggplot(data) + coord_cartesian() + ggsize(600, 200)
In [3]:
p + geom_tile(aes(x='x', fill='x')) + \
    scale_fill_gradientn(colors=['#2b83ba', 'green', '#d7191c'])
Out[3]:
In [4]:
p + geom_tile(aes(x='x', color='x'), fill='white', size=2) + \
    scale_color_gradientn(colors=['#2b83ba', 'green', '#d7191c'])
Out[4]:
In [5]:
p + geom_tile(aes(x='x', fill='x')) + \
    scale_fill_gradientn(colors=['red', 'orange', 'yellow', 'green', 'light_blue', 'blue', 'magenta'])
Out[5]:
In [6]:
# Asymmetric gradient
p + geom_tile(aes(x='x', fill='x')) + \
    scale_fill_gradientn(colors=[*['#2b83ba']*4, 'green', '#d7191c'])
Out[6]: