Skip to content

scale_fill_manual values not respected #384

@tdhock

Description

@tdhock

Hi, I noticed that this code works in 0.8.x but not 0.9. Basically, I want to specify custom fill colors for geom_rect, but sometimes one of the colors disappears.

pro = data.frame(position=c(10,20),logratio=rnorm(2))
library(ggplot2)
sc = scale_fill_manual(values=c(
                      "1breakpoint"="#ff7d7d",
                      "normal"="#f6f4bf",
                      ">0breakpoints"="#a445ee"
                      ))
makeplot = function(ann){
ggplot()+
  geom_rect(aes(xmin=min,xmax=max,fill=annotation),
            ymax=2,ymin=-2,data=ann)+
  geom_point(aes(position,logratio),pch=1,colour="black",data=pro)
}
(p = makeplot(data.frame(min=c(10,13,18),max=c(12,15,20),
  annotation=c(">0breakpoints","1breakpoint","normal")))) #ok
p+sc ##ok
(p =makeplot(data.frame(min=c(10,13,18),max=c(12,15,20),
  annotation=c("1breakpoint",">0breakpoints",">0breakpoints")))) #ok
p+sc ## >0breakpoints color not what I specified in scale_fill_manual!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions