ggplot2: separate color scale per facet

前端 未结 2 1254
借酒劲吻你
借酒劲吻你 2020-12-29 05:24

Intuitively I\'m looking for something like: facet_(scales=\"free_color\")

I do something like

p <- ggplot(mpg, aes(year, displ, colo         


        
2条回答
  •  北海茫月
    2020-12-29 06:01

    I think you simply want to color by class, where each manufacturer makes several models, each only one or two per class:

    p <- ggplot(mpg, aes(year, displ, color=class)) + facet_wrap(~ manufacturer)
    p + geom_jitter()
    

    alt text

提交回复
热议问题