rgldev(
  filename = NULL,
  width = 8,
  height = 6,
  dpi = 72,
  fov = 0,
  view = c("front", "flat"),
  view_angle = 0,
  view_flat_angle = -45,
  zoom = 0.8,
  view3d_args = NULL,
  light = list(theta = 20, phi = 20),
  background = list(color = "white"),
  zscale = 1,
  close_window = FALSE,
  circle_segments = 10,
  show_window = interactive(),
  verbosity = 0,
  polygon_offset_delta = 0.1,
  ...
)

Arguments

filename

Filename to save output to. Default: NULL (display only). Currently only PNG (use '.png' as suffix) and WebGL (use '.html' as suffix) output supported. Consider using show_window = FALSE when only saving to file, to avoid opening an opengl window on the screen.

width, height

Screen or output dimensions in inches. Default 8x6

dpi

Resolution. Default 72 (for screen display). A higher value (e.g. 150 or 300) is recommended when saving to PNG.

fov

Field of view. Default: 0, indicates an isometric view where objects do not dimish with size into the distance. For regular perspective, try values of 30, or really anythin in the range [0, 180].

view

One of 'front', 'flat'. This will be ignored if view3d_args is set.

view_angle

rotation angle of view in degrees. Only used if view is 'front' or 'flat'. Default: 30

view_flat_angle

angle to tip view when view is 'flat'.

zoom

zoom level. default 0.66. Larger values make the plot appear further from the screen.

view3d_args

full viewpoint specification as a list of arguments to rgl::view3d(). Default: NULL

light

Set the light position. This is a list of arguments to a call to rgl::rgl.light().

background

Set the initial background. This is a list of arguments to a call to rgl::rgl.bg()

zscale

Global Z scaling. Default: 1. This is used as the argument in a call to rgl::aspect3d(1, 1, zscale)

close_window

Close window when dev.off() called? Default: FALSE (leave window open).

circle_segments

Circles in devoutrgl are rendered as polygons with this number of segments. Default: 10

show_window

Show rendering window? Default: display window only if interactive() is TRUE.

verbosity

Set the verbosity level. Default 0 (be quiet), values up to 99 for maximum verbosity.

polygon_offset_delta

incremental change in polygon_offset after every element is rendered. Adjust this value to try and minimise issues with z-fighting of overlapping elements.

...

other args passed in to device 'rdata'

Examples

if (FALSE) { library(devoutrgl) library(ggplot2) p <- ggplot(mtcars) + geom_density(aes(mpg, fill=as.factor(cyl)), colour = '#ffffff00') + theme(legend.position = 'none') + theme_bw() rgl( fov = 30 ) p invisible(dev.off()) }