prepare_figure: Make ggplot Figure Pretty

Description Usage Arguments Value Examples

View source: R/ubiquity.r

Description

Takes a ggplot object and alters the line thicknesses and makes other cosmetic changes to make it more appropriate for exporting.

Usage

1
2
3
4
5
6
7
8
prepare_figure(
  purpose = "present",
  fo,
  y_tick_minor = FALSE,
  y_tick_major = FALSE,
  x_tick_minor = FALSE,
  x_tick_major = FALSE
)

Arguments

purpose

either "present" (default), "print" or "shiny"

fo

ggplot figure object

y_tick_minor

Boolean value to control grid lines

y_tick_major

Boolean value to control grid lines

x_tick_minor

Boolean value to control grid lines

x_tick_major

Boolean value to control grid lines

Value

ggplot object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library("ggplot2")
df = data.frame(x = seq(0.01,10,.01),
               y = seq(0.01,10,.01)^2)
p       = ggplot(df, aes(x=x, y=y)) + geom_line()
# pretty up the axes
p       = prepare_figure(fo=p, purpose="print")
# pretty log10 y-axis 
p_logy  = gg_log10_yaxis(fo=p)
# pretty log10 x-axis 
p_logx  = gg_log10_xaxis(fo=p)
# pretty log10 yx-axis 
p_logxy = gg_axis(fo=p)

Example output

Coordinate system already present. Adding new coordinate system, which will replace the existing one.

ubiquity documentation built on Sept. 5, 2021, 5:15 p.m.