lets-plot icon indicating copy to clipboard operation
lets-plot copied to clipboard

scale manual: behavior with specified `breaks` and `limits` parameters

Open OLarionova-HORIS opened this issue 2 years ago • 0 comments

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: Screenshot 2023-11-20 at 15 31 22

Similar plot using ggplot2:

Screenshot 2023-11-20 at 15 10 54

The ggplot2 result seems more correct: the values (colors) correspond to the items specified in the breaks parameter.

OLarionova-HORIS avatar Nov 20 '23 14:11 OLarionova-HORIS