I have this sample dataset for three labeled images:
set.seed(2021)
data_example <- lapply(c(1,2,3), function(i) {
expand.grid(Row=1:4,Col=1:4) %>%
mutate(label = i)
})
data_example <- Reduce(rbind,data_example)
data_example$value <- sample(0:255,48)
And I created a ggplot for faceted images, but when trying to change the width of the colorbar, I can't:
ggplot(data_example, aes(Row,Col,fill=value)) +
geom_raster()+
scale_y_reverse()+
scale_fill_gradient(low="white", high="blue") +
facet_wrap(~label) +
guides(color = guide_colorbar(barwidth = unit(.5,"lines")))
Any help will be greatly appreciated.
