type num keeps returning Error: Discrete value supplied to continuous scale

str(long.plexin)
'data.frame': 16672 obs. of 3 variables:
CLASS : chr "TLX1" "PRAC1" "CAT" "TBX1" ... variable: num NA NA NA NA NA NA NA NA NA NA ...
$ value : num 0.144 1.544 0 0.209 0.162 ...

heatmap.plot <- ggplot(data = long.plexin, aes(x = "CLASS", y = "variable")) +

  • geom_tile(aes(fill = "value")) +
    
  • scale_fill_gradient2() +
    
  • theme(axis.text.y = element_text(size = 6))
    

print(heatmap.plot)
Error: Discrete value supplied to continuous scale

cant pinpoint why its return this error

edit:.. oh.. the NA values?

You are using wrong syntax, you shouldn't quote the variable names.

This should be:

ggplot(data = long.plexin, aes(x = CLASS, y = variable)) + 
  geom_tile(aes(fill = value)) +
  scale_fill_gradient2()

with fill = "value" ggplot2 assumes there is a column in you data containing only the character "value". This is the "discrete" value that the error message is referring to.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.