edit
How can I change axis lines to arrows on my plot?
Here a sample plot where both axis should have arrows at the end (plot from user chemdork123's answer).
ggplot(mtcars, aes(mpg,disp)) + geom_point() + theme_minimal()
edit
How can I change axis lines to arrows on my plot?
Here a sample plot where both axis should have arrows at the end (plot from user chemdork123's answer).
ggplot(mtcars, aes(mpg,disp)) + geom_point() + theme_minimal()
To represent the x or y axis as an arrow, you can access the theme()
elements for those objects. This is a good place to go for information on the theme objects you can modify.
In this case, you'll want to access axis.line
(for all axes) or axis.line.x
or axis.line.y
to access either x or y axes individually. The arguments must be changed via calling element_line()
and then within element_line()
there is an argument for arrow=
where you can use the arrow()
function to change the look of the arrows.
Here's an example using mtcars
:
ggplot(mtcars, aes(mpg,disp)) + geom_point() + theme_minimal() +
theme(axis.line = element_line(arrow = arrow(type='closed', length = unit(10,'pt'))))