[R] ggplot scale_colour_distiller legend to display all values?

Mike Smith mike at hsm.org.uk
Mon May 9 23:24:19 CEST 2016

Is there a way to get ggplot scale_colour_distiller to display all values in the legend? 

Currently using this code.



#Input data: insert the filename for raw data
data <- read.csv("http://www.lecturematerials.co.uk/data/learning_bands.csv",header=T)

ggplot(data,aes(x=multiplier,y=factor)) +
  geom_point(aes(colour=band), size=8, shape=15) +
  scale_colour_distiller(palette = "Spectral", direction=-1, guide="legend", name="Order") +
  ggtitle("Times Tables Learning Bands") +
  scale_x_continuous(name="Multiplier", limits=c(2, 12), breaks=c(2,4,6,8,10,12)) +
  scale_y_continuous(name="Factor", limits=c(2, 12), breaks=c(2,4,6,8,10,12)) + 
  geom_abline(intercept = 0, slope = 1, size=1) +

Mike Smith

More information about the R-help mailing list