I am using scale_x_discrete()
to customize ticks and labels of x-axis.
However, as figure shows, the lines cut the right-side y-axis, which doesn\'t look g
There is also the "expand" argument from the ggplot website. Adjust the numbers to whatever look you are trying to achieve
a + scale_x_discrete(breaks = c("2","4","8","16","32","64","128"),
labels=c("2","4","8","16","32","64","128"),
expand = c(.1,.1))
Why are you using a discrete scale for something at appears to be continuous.
If you replace scale_x_discrete
with scale_x_continuous
then this should work as you wish.
b <- a + scale_x_continuous(breaks = 2^(1:7))
b
You might be interested in a transformation to base 2, given the way your data for b
appear only to be integer powers of 2.
a + scale_x_continuous(breaks = 2^(1:7), trans = 'log2')