gsvg: widget to display svg files

Description Usage Arguments Value Examples

View source: R/gsvg.R

Description

This widget displays an svg file, such as is made by the svg driver or the devSVGTips driver in the RSVGTipsDevice. The basic usage is like gimage, where a file that is stored in a place the web browser can serve is used as the file specified to the device. The convenience method get_tempfile (and function) is used to create such a file. Use the .svg extension. The widget size is specified in pixels, but the svg device driver is in inches.

Usage

1
2
gsvg(f, width = 480, height = 400, container = NULL, ...,
  ext.args = NULL)

Arguments

f

filename. Usually produced by get_tempfile(ext=".svg").

width

width of widget in pixels

height

height of widget in pixels

container

parent container

...

passed to add method of parent container

ext.args

Means to pass additional arguments to Ext constructor

Value

An ExtWidget instance

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
w <- gwindow("hello", renderTo="replaceme")
sb <- gstatusbar("Powered by gWidgetsWWW and Rook", cont=w)
g <- ggroup(cont=w, horizontal=FALSE)
require(RSVGTipsDevice)

f <- get_tempfile(ext=".svg") ## use this extension
svg(f)
hist(rnorm(100))
dev.off()

i <- gsvg(f, container=g, width=480, height=480)



b <- gbutton("click", cont=g, handler=function(h,...) {
  f <- get_tempfile(ext=".svg")
  svg(f)
  hist(rnorm(100))
  dev.off()
  svalue(i) <- f
})

## End(Not run)

jverzani/gWidgetsWWW2 documentation built on Feb. 9, 2020, 5:18 p.m.