lets-plot
lets-plot copied to clipboard
scale manual: behavior with specified `breaks` and `limits` parameters
Example:
p = ggplot(mpg2.head(32), aes('miles per gallon', 'vehicle weight (lbs.)')) + \
geom_point(aes(color=as_discrete('number of cylinders')))
p + scale_color_manual(
values = ["red", "blue", "darkgreen", "orange"],
breaks = [8, 4, 6, 10],
limits = [4, 8]
)
Result:
Similar plot using ggplot2:
The ggplot2 result seems more correct:
the values (colors) correspond to the items specified in the breaks parameter.