graph_place_axis: Add axis at the specified coordinate on a ggplot2 graph

Description Usage Arguments Value Examples

View source: R/graph_place_axis.R

Description

Add axis at the specified coordinate on a ggplot2 graph

Usage

1
graph_place_axis(graph, x = 0, y = 0, xunit = 0.5, yunit = 0.5)

Arguments

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)

Value

A formated graph.

Examples

 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)

NicolasJBM/writer documentation built on Aug. 12, 2019, 2:36 p.m.