4
votes

If I use ggplot, then the horizontal line for the x axis (y==0) is the same as any other value for y. I'd like to highlight the fact that the bottom of the graph is NOT the x axis, and that the x axis is higher in the plot. How can I do this?

data.df <- data.frame(Plant = c("Plant1", "Plant1", "Plant1", "Plant2", "Plant2", "Plant2"), Type = c(1, 2, 3, 1, 2, 3), Axis1 = c(0.2, -0.4, 0.8, -0.2, -0.7, 0.1), Axis2 = c(0.5, 0.3, -0.1, -0.3, -0.1, -0.8))

ggplot(data.df, aes(x = Axis1, y = Axis2, shape = Plant, color = Type)) + geom_point(size = 5)
2

2 Answers

6
votes

You could highlight the axes with black lines

ggplot(data.df, aes(x = Axis1, y = Axis2, shape = Plant, color = Type)) +
geom_point(size = 5) +
geom_hline(aes(yintercept = 0)) +
geom_vline(aes(xintercept = 0))
5
votes

you can also change the colour and width of the axes directly by adding e.g.:

+ theme(axis.line = element_line(colour = 'red', size = 2))