I'd like to make my report using only two colors. I would like to know what's the default color of smooth curve in ggplot2 called so I can name my bar/line/pie accordingly. Thanks.
By default, ggplot2 chooses to use a specific shade of red, green, and blue for the bars.
Change colors manually A custom color palettes can be specified using the functions : scale_fill_manual() for box plot, bar plot, violin plot, etc. scale_color_manual() for lines and points.
The geom smooth function is a function for the ggplot2 visualization package in R. Essentially, geom_smooth() adds a trend line over an existing plot.
Following @Konrad's comment pointing here:
library("ggplot2")
dd <- data.frame(x=1:10,y=1:10)
g1 <- ggplot(dd,aes(x,y))+geom_smooth()
unique(ggplot_build(g1)$data[[1]]$colour) ## "#3366FF"
plot(1,1,cex=8,pch=16,col="#3366FF")
This is not actually an exact duplicate of emulate ggplot colour palette: if we build a three-category coloured plot plus a smooth we get:
sapply(ggplot_build(g1)$data,function(x) unique(x$colour))
## [[1]]
## [1] "#F8766D" "#00BA38" "#619CFF" # three colours from colour wheel
## [[2]]
## [1] "#3366FF" # geom_smooth colour
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