get_time_axis: Manually draw an x-axis

Description Usage Arguments Value

Description

Sometimes you may want to put the x axis in certain locations other than the periphery of the plot as in the default ggplot option. Here I only implemented the version for x axis but it would be trivial for y axis as well. The underlying rationale is simple. Draw the axis and put on the labels.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
get_time_axis(
  min_x,
  max_x,
  x_name,
  AP,
  y_level = 0,
  shorten_ratio = 0.85,
  ticks_df = NULL,
  tick_height = 0.005
)

Arguments

min_x

where to draw the x axis from

max_x

where the axis ends

x_name

name for the x axis

AP

aesthetic paameters

y_level

which y coordinate

shorten_ratio

shorten the x axis from max_x. This is because sometimes the axis tip is cut off from the edge of the plot.

ticks_df

a dataframe for plotting the axis ticks

Value

a list of ggplot layers, must contain a column called x for the locations of the ticks and the labels to put on


Yutong441/TBdev documentation built on Dec. 18, 2021, 8:22 p.m.