lets-plot
lets-plot copied to clipboard
as_discrete: the label parameter is ignored if the levels parameter is set
from lets_plot import *
LetsPlot.setup_html()
d = {
'x': [1, 2],
'y': [0, 0],
'c': [1, 2]
}
ggplot(d, aes(x='x', y='y')) \
+ geom_point(aes(color=as_discrete('c', label="CCC", levels=[2, 1]))) + ggtitle("label='CCC', levels=[2, 1]")
Expected - legend title "CCC" with legend rows 2 and 1
Actual - rows order is 2 and 1, but title is "c":