axi_dev | R Documentation |
axi_dev()
opens up a graphic device that takes plotting instructions from
e.g. plot()
or ggplot2, and renders it with the AxiDraw. ghost_dev()
behaves like axi_dev()
, but instead of sending instructions to the plotter
it will collect them and allow you to preview the movement of the pen and
send the instructions to the plotter at a later stage. For more complex plots
it is adviced to use the asynchronous ghost_dev()
as it makes it easier to
pause and rewind the plot if something goes wrong or a pen runs dry.
axi_dev(
paper_size = "A4",
portrait = TRUE,
margins = 20,
tip_size = 1,
color = "black",
ignore_color = TRUE,
ignore_lwd = FALSE,
line_overlap = 0.1,
min_overlap = -20,
draw_fill = TRUE,
fill_type = "hatch",
circle_erode_threshold = 2,
hatch_angle = 45,
connect_hatch = TRUE,
optimize_order = "all",
instant = FALSE,
pens = list(),
options = axi_options()
)
ghost_dev(
paper_size = "A4",
portrait = TRUE,
margins = 20,
tip_size = 1,
color = "black",
ignore_color = TRUE,
ignore_lwd = FALSE,
line_overlap = 0.1,
min_overlap = -20,
draw_fill = TRUE,
fill_type = "hatch",
circle_erode_threshold = 2,
hatch_angle = 45,
connect_hatch = TRUE,
optimize_order = "all",
pens = list(),
options = axi_options()
)
paper_size |
The size of the paper to draw on, either as a numeric vector giving dimensions in mm, or as a standard paper size name. |
portrait |
Logical. Is the paper oriented as portrait (i.e. width < height). Will rearrange given paper dimensions to fit. |
margins |
The margins of the paper, in mm. The spec follows that of css, meaning that if it is given as a single value it defines all margins, if given as two values it defines top/bottom, left/right, if it is given as three values it defines top, left/right, bottom, and if it is given as four values it defines top, right, bottom, left. |
tip_size |
The size of the tip (i.e. the width of the line it draws) of the initial pen |
color |
The color of the initial pen |
ignore_color |
Logical. Should changes in color output be ignored? If
|
ignore_lwd |
Logical. Should the device ignore the lwd and also just draw lines as a single pen stroke? |
line_overlap |
The overlap between adjacent pen strokes when filling out
shapes and drawing thick lines, in mm. Setting this to a negative amount will
cause gaps between the lines. If |
min_overlap |
The lower bound in mm of the overlap if it is being calculated from the color/fill alpha. Should be a negative value to ensure low alpha results in gapped hatching. |
draw_fill |
Logical. Should fill be drawn using hatching? |
fill_type |
How should shapes be filled? Either |
circle_erode_threshold |
At which radius (in mm) should circles begin to
be filled by erosion instead of hatching when |
hatch_angle |
Angle in degrees that the hatching of fill should be drawn
with. If |
connect_hatch |
Should hatches be connected if possible or should the pen be lifted between each hatch line? |
optimize_order |
Either |
instant |
Should plotting happen the instant a primitive is drawn or only when needed (before pen change, when finishing) |
pens |
One or more pen specifications created using |
options |
An |
At the moment the device does not support text. This will hopefully change in the future.
gd <- ghost_dev('A6')
par(mar = c(0, 0, 0, 0))
plot(cars)
lines(lowess(cars))
invisible(dev.off())
gd$preview(plot_air = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.