Uses the export endpoint to export a chart as PNG, PDF, or SVG (the latter two require paid plans).
dw_export_chart( chart_id, type = c("png", "pdf", "svg"), unit = c("px", "inch", "mm"), mode = c("rgb", "cmyk"), width = NULL, height = NULL, plain = TRUE, scale = 2, border_width = 0, border_color = NULL, transparent = FALSE, api_key = "environment" )
chart_id | Required. A Datawrapper-chart-id as character string, usually a five character combination of digits and letters, e.g. "aBcDe". Or a dw_chart-object. |
---|---|
type | Required. One of |
unit | Define units which |
mode | color movde for output. Defaults to |
width, height | width and height of the visualization; if not specified it takes the chart width/height. |
plain | if |
scale | defines multiplier for the size; e.g. if |
border_width | margin around the visualization; e.g. if |
border_color | color of the border; The default is the same as the visualization (likely |
transparent | make the background transparent; The default is |
api_key | Optional. A Datawrapper-API-key as character string. Defaults to "environment" - tries to automatically retrieve the key that's stored in the .Reviron-file by |
for png
, a {magick}
object; for pdf
, invisible raw vector with PDF content; for svg
, invisible character vector with SVG content
PDF and SVG export require paid plans
Bob Rudis bob@rud.is
if (FALSE) dw_export_chart("aBcDE") # uses the preset key in the .Renviron-file