save.d3: Save d3 diagram as png

View source: R/save.d3.R

save.d3R Documentation

Save d3 diagram as png

Description

Saves d3 diagram as a png image using webshot.

Usage

save.d3(
  d3,
  file,
  width = 1000,
  height = 750,
  delay = 0.2,
  zoom = 1,
  background = "white",
  title = "D3 Visualization"
)

Arguments

d3

A d3 object.

file

Location to save image. Must have extension ".png" or ".html".

width

Width of image.

height

Height of image.

delay

Time to wait before taking screenshot, in seconds. Sometimes a longer delay is needed for all assets to display properly.

zoom

Zoom before screenshot.

background

Background color of diagram.

title

Title for HTML diagram.

Examples

## Not run: 
data(energy)

d3 = sankey(energy)
f = paste0(tempfile(), ".html")
save.d3(d3, f)

## End(Not run)


tkmckenzie/d3po documentation built on June 2, 2022, 2:41 p.m.