Reputation: 307
I have code following:
df=data.frame(time=as.factor(rep(0.5:9.5,each=10)),
roi=rep(1:10,10),
area=runif(100, 5.0, 7.5))
df$time=factor(df$time, levels=rev(levels(df$time)))
ggplot(data=df, aes(x=factor(roi), y=time, fill = area)) +
theme_minimal() +coord_fixed(ratio=1) +
geom_tile(colour = NA, width = 1.5, height = 1)+
scale_fill_gradient(low="black",high="white") +
scale_y_discrete(name="Time (min)",
expand =c(0,0),breaks=c(0.5,2.5,5.5,7.5,9.5),
labels=c(0,15,30,45,60))
How can I get the y label close to the plot area.
Great thanks to any response!
Upvotes: 0
Views: 694
Reputation: 9923
Set axis.ticks.length
to zero in theme
to remove this space
ggplot(data=df, aes(x=factor(roi), y=time, fill = area)) +
theme_minimal() +
coord_fixed(ratio=1) +
geom_tile(colour = NA, width = 1.5, height = 1)+
scale_fill_gradient(low="black",high="white") +
scale_y_discrete(name="Time (min)",
expand =c(0,0),breaks=c(0.5,2.5,5.5,7.5,9.5),
labels=c(0,15,30,45,60)) +
theme(axis.ticks.length = unit(0, "lines"))
Upvotes: 4