Reputation: 776
once again I'm stuck, I want to get rid of the additional spacing that is present on the y-axis and the x-axis.
I'm aware that this spacing prevents that some datapoints can interfere with the axis and therefore reduce the readibility of the chart. But right now, I want to get rid of this space that is used in the plottingarea.
Here is my code
library(ggplot2)
df <- data.frame(category = c("A", "B"), value=c(3,4))
q <- ggplot(data=df)
q <- q + geom_bar(aes(x=category, y=value, stat="identity"))
q
I think breaks would not work because this just an example dataset
Upvotes: 2
Views: 116
Reputation: 132576
q <- ggplot(data=df,aes(x=category, y=value))
q <- q + geom_bar(stat="identity")
q + scale_x_discrete(expand=c(0,0)) + scale_y_continuous(expand=c(0,0))
Upvotes: 3