user
user

Reputation: 253

How to draw x and y axis in ggplot2 R?

So, I'd like to draw x and y axis using ggplot2. I managed to draw x axis with a function: fun = function{x} {x* 0 }, but I don't know how to do the same with y axis. If I use built in functions that draw x and y axis, like for example: theme(axis.line.x = element_line(...)), then I get the lines to be outside the plot itself, but I need the axis to see where they intersect with other functions. Can anyone assist?

Upvotes: 0

Views: 1155

Answers (1)

Elle
Elle

Reputation: 1008

Try:

+ geom_hline(yintercept = 0) + geom_vline(xintercept = 0)

Upvotes: 2

Related Questions