scale_fill_gradientn(colours = rev(colorRampPalette(brewer.pal(11,"RdBu"))(11)[6:11],
breaks = data.breaks
guide = guide_colorbar(title = legend.unit,
nbin = 6, raster = F))
Would you please advise how I could get a color bar with 6 colors?
Thanks a lot. It has been troubled me for a long time and my temporary solution is to transform the continuous data to some discrete values and plot them with discrete color legend.
Regards,
fkm
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+unsubscribe@googlegroups.com
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You seem to be using continuous values, you should definitely factorize those values if you want a discrete scale, that 's what ggplot expects of you at least. So cut them with cut, and assign a label to each bin... something along these lines:Adriano Fantini2018-01-24 6:49 GMT+01:00 Ka Ming Fung <fkm...@gmail.com>:Hey guys,I have a data frame with a list of lon, lat and continuous values. I want to make the color bar with 6 colors like this:So I tried the following codes:scale_fill_gradientn(colours = rev(colorRampPalette(brewer.pal(11,"RdBu"))(11)[6:11],
breaks = data.breaksguide = guide_colorbar(title = legend.unit,
nbin = 6, raster = F))But what I got is a color bar with 7 color, like this,Would you please advise how I could get a color bar with 6 colors?
Thanks a lot. It has been troubled me for a long time and my temporary solution is to transform the continuous data to some discrete values and plot them with discrete color legend.
Regards,
fkm
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
To unsubscribe: email ggplot2+unsubscribe@googlegroups.com
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+unsubscribe@googlegroups.com.