A seemingly simple problem has me stumped. Is it possible to choose the
number of colour breaks for a gradient scale in the current version of
ggplot2?

Here is a simple example:

---------------------------------------------
x=-10:10
y=-10:10
dat=expand.grid(x=x,y=y)
dat$z=dat$x^2+dat$y^2-100

ggplot(dat, mapping=aes(x=x, y=y, fill=z)) +
  geom_tile() + scale_fill_gradient2()
---------------------------------------------

The image shows many (61) colours, but only 5 of them are shown in the
legend. How do I change the legend to show, say, 10 colours?

-- 
Karl Ove Hufthammer

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to