# NOT RUN {
# Example 1: use vectors.
x=c("b", "a", "c", "d", "e")
y=c(2, 1, 3, 5, 4)
raster=list(c("blue", "red"), c("green", "orange"),
c("cyan", "yellow"), c("purple", "orangered"), c("grey", "red"))
ggplot()+
geom_shading_bar(aes(x=x, y=y, raster=raster), smooth=40)
#
# Example 2: other parameters
x=1: 5
y=c(1, 2, -3, 5, 4)
raster=list(c("blue", "red"))
ggplot()+
geom_shading_bar(aes(x=x, y=y, raster=raster),
smooth=50, width=0.6, equal_scale=TRUE)+
scale_x_continuous(breaks=1: 5, labels=letters[1: 5])
# }
Run the code above in your browser using DataLab