from lets_plot import *
LetsPlot.setup_html()
A continuous color scale with guide='legend' should render discrete legend keys instead of a colorbar.
data = {'x': [1, 2, 3, 4, 5], 'y': [2, 4, 1, 5, 3], 'v': [10, 20, 30, 40, 50]}
(
ggplot(data, aes('x', 'y', color='v'))
+ geom_point(size=5)
+ scale_color_gradient(low='blue', high='red', guide='legend')
+ ggtitle("guide='legend' on a continuous color scale - should show legend keys")
)
Without an explicit guide, the continuous color scale should keep its default colorbar.
(
ggplot(data, aes('x', 'y', color='v'))
+ geom_point(size=5)
+ scale_color_gradient(low='blue', high='red')
+ ggtitle('No guide parameter - the default colorbar should still appear')
)
An explicit colorbar guide should continue to render as a colorbar.
(
ggplot(data, aes('x', 'y', color='v'))
+ geom_point(size=5)
+ scale_color_gradient(low='blue', high='red', guide='colorbar')
+ ggtitle("Explicit guide='colorbar' - should still show a colorbar")
)
Suppressing the guide should continue to hide it completely.
(
ggplot(data, aes('x', 'y', color='v'))
+ geom_point(size=5)
+ scale_color_gradient(low='blue', high='red', guide='none')
+ ggtitle("guide='none' - no guide should appear")
)
The same guide behavior should apply to continuous fill scales.
tile_data = {
'x': [1, 2, 3, 1, 2, 3],
'y': [1, 1, 1, 2, 2, 2],
'v': [10, 20, 30, 40, 50, 60]
}
(
ggplot(tile_data, aes('x', 'y', fill='v'))
+ geom_tile()
+ scale_fill_gradient(low='white', high='darkblue', guide='legend')
+ ggtitle("scale_fill_gradient guide='legend' - fill scale should respect guide='legend'")
)