Generates a cylindrical grid of the appropriate dimensions for a 3D volcano plot

polar_grid(
  r_vector = NULL,
  z_vector = NULL,
  r_axis_ticks = NULL,
  z_axis_ticks = NULL,
  axis_angle = 5/6,
  n_spokes = 12,
  axes_from_origin = TRUE,
  ...
)

Arguments

r_vector

An optional numerical vector for the radial coordinates. This is used to calculate breaks on the r axis using pretty. If this is NULL the r_axis_ticks are used as breaks.

z_vector

An optional numerical vector for the z coordinates. This is used to calculate breaks on the z axis using pretty. If this is NULL the z_axis_ticks are used as breaks.

r_axis_ticks

A numerical vector of breaks for the radial axis (used if r_vector is NULL).

z_axis_ticks

A numerical vector of breaks for the z axis (used if z_vector is NULL).

axis_angle

angle in radians to position the radial axis (default = 5/6)

n_spokes

the number of outward spokes to be plotted (default = 12)

axes_from_origin

Whether the axis should start at 0 or the first break (default = TRUE)

...

optional parameters for pretty on the r axis

Value

Returns an S4 grid object containing:

  • 'polar_grid' The coordinates for a radial grid

  • 'axes' The axes features for 'plotly'

  • 'axis_labels' The axis labels

  • 'r' The grid radius

  • 'z' The grid height

  • 'text_coords' The coordinates for text labels

  • 'n_r_breaks' The number of ticks on the r axis

  • 'n_r_breaks' The number of ticks on the z axis

References

Lewis, Myles J., et al. (2019). Molecular portraits of early rheumatoid arthritis identify clinical and treatment response phenotypes. Cell reports, 28:9

Examples

data(example_data)
syn_polar <- polar_coords(outcome = syn_example_meta$Pathotype,
                          data = t(syn_example_rld))

grid <- polar_grid(r_vector=syn_polar@df[[1]]$r,
           z_vector=NULL,
           r_axis_ticks = NULL,
           z_axis_ticks = c(0, 8, 16, 32),
           n_spokes = 4)