Description Usage Arguments Value Examples
View source: R/graph_place_axis.R
Add axis at the specified coordinate on a ggplot2 graph
1 | graph_place_axis(graph, x = 0, y = 0, xunit = 0.5, yunit = 0.5)
|
graph |
ggplot2 graph. |
x |
Numeric. Where the x axis should appear. |
y |
Numeric. Where the y axis should appear. |
xunit |
Numeric. Units of the x axis (for breaks) |
yunit |
Numeric. Units of the y axis (for breaks) |
A formated graph.
1 2 3 4 5 6 7 8 9 10 11 12 13 | library(ggplot2)
library(dplyr)
library(writer)
g <- iris %>%
mutate_if(is.numeric, scale) %>%
ggplot(aes(x = Sepal.Length, y = Petal.Length, color = Species)) +
geom_point() +
geom_smooth(method = "lm") +
scale_colour_grey() +
scale_x_continuous(breaks = seq(-2, 10, 0.5)) + xlab("Setal") +
scale_y_continuous(breaks = seq(-2, 10, 0.5)) + ylab("Pepal") +
graph_theme(axis = FALSE, legend.position = "bottom")
graph_place_axis(g, x = 0, y = 0, xunit = 0.5, yunit = 0.5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.