Possible Duplicate:
automatic non-equidistant breaks in ggplot2
I am creating a ggplot2 heat map chart. My Data is as follows:
df
Date Value Desc
1/1/2012 40 Brasil
1/1/2012 90 Argentina
1/1/2012 10 England
1/1/2012 5 China
2/1/2012 40 Brasil
2/1/2012 90 Argentina
2/1/2012 10 England
2/1/2012 24 China
3/1/2012 40 Brasil
3/1/2012 90 Argentina
3/1/2012 10 England
1/1/2012 0 China
ggplot(df, aes(Date, Desc, fill=Value)) + geom_tile(colour="white") + scale_fill_gradient(low="white", high="red"")
ggplot comes up with its default scale from 10 to 50 etc on the right as legend. How can I manually alter this? Rather than having 10, 15, 20, 60 etc. I like to have lowest to highest with break points?
You want the breaks argument I think. see ?scale_fill_gradient for a description:
ggplot(df, aes(Date, Desc, fill=Value)) +
geom_tile(colour="white") +
scale_fill_gradient(low="white",
high="red",
breaks=seq(min(df$Value), max(df$Value), by=30))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With