pointsvg {StratigrapheR}R Documentation

Converts line, rect, polygon and polyline class SVG objects into data frames

Description

Converts 'line', 'rect', 'polygon' and 'polyline' class SVG objects into data frames. ONLY THESE CLASSES OF OBJECTS CAN BE IMPORTED. If you have bezier or spline curves, they will be stored as 'path' class objects that cannot be imported here. The same goes for 'rect' objects that are transformed (rotation, etc...).

Usage

pointsvg(
  file,
  standard = TRUE,
  keep.ratio = FALSE,
  round = TRUE,
  xdigits = 4,
  ydigits = 4,
  xinverse = FALSE,
  yinverse = TRUE,
  warn = T
)

is.pointsvg(object)

Arguments

file

a .svg file

standard

whether to standardise (centre to (0,0), rescale so that extreme points are at -1 and 1) (T or F)

keep.ratio

if the object is to be standardised, whether to keep the x/y ratio (T or F)

round

whether to round the coordinates (T or F)

xdigits

the number of digits after the decimal to round to for x values

ydigits

the number of digits after the decimal to round to for y values

xinverse

whether to inverse the plotting for x values (T or F)

yinverse

whether to inverse the plotting for y values (T or F)

warn

whether you want to be annoyed

object

for is.pointsvg, the R object to be checked if it can be considered similarly to a svg outputted by pointsvg

Details

This function is quite empirical. There is no guarantee it is bug free. If you have .svg files that should work but do not, you can email me: wouterseb@gmail.com

Value

A data.frame with x and y coordinates, ids for each object, and a type, either line (L) or polygon (P)

See Also

Plot the drawing: placesvg,

Plot the drawing and change the coordinates :centresvg and framesvg

Change the drawing: changesvg and clipsvg

Examples

# To show you how to import, we first have to have a svg file to import. The
#following lines of code will create a svg in a temporary files:

svg.file.directory <- tempfile(fileext = ".svg") # Creates temporary file
writeLines(example.ammonite.svg, svg.file.directory) # Writes svg in the file

print(paste("An example .svg file was created at ", svg.file.directory,
            sep = ""))

# The pointsvg function allows to import simple svg drawings into R

ammonite.drawing <- pointsvg(file = svg.file.directory) # Provide file

is.pointsvg(ammonite.drawing)

plot(c(-2,2), c(-2,2), type = "n")

placesvg(ammonite.drawing)

# If you want to import your own .svg file uncomment the following line:

# pointsvg(file.choose())


[Package StratigrapheR version 1.3.1 Index]