Package grimport. R topics documented: February 20, 2015

Similar documents
Package grimport2. March 20, 2018

Importing Vector Graphics: The grimport Package for R

Package gridextra. September 9, 2017

Package gridgraphics

Package gggenes. R topics documented: November 7, Title Draw Gene Arrow Maps in 'ggplot2' Version 0.3.2

Writing grid Code. Paul Murrell. December 14, 2009

Package desplot. R topics documented: April 3, 2018

Package gridgraphviz

Package smoothr. April 4, 2018

Package meme. November 2, 2017

Simfit. Stack Plot. Rows. Columns. Titles and Legends

Package datasets.load

Introduction To Inkscape Creating Custom Graphics For Websites, Displays & Lessons

Package sankey. R topics documented: October 22, 2017

Scalable Vector Graphics (SVG) vector image World Wide Web Consortium (W3C) defined with XML searched indexed scripted compressed Mozilla Firefox

Package meme. December 6, 2017

Package pairsd3. R topics documented: August 29, Title D3 Scatterplot Matrices Version 0.1.0

Package Mondrian. R topics documented: March 4, Type Package

How to draw and create shapes

Package Binarize. February 6, 2017

Package osrm. November 13, 2017

Graphics and Java 2D Introduction OBJECTIVES. One picture is worth ten thousand words.

Package areaplot. October 18, 2017

Talk Overview. grid Graphics and Programming. The Structure of R Graphics. Introduction to grid

How to...create a Video VBOX Gauge in Inkscape. So you want to create your own gauge? How about a transparent background for those text elements?

DEC HEX ACTION EXTRA DESCRIPTION

Package RGraphics. March 11, 2014

Package pathdiagram. R topics documented: August 29, 2016

Package superheat. February 4, 2017

Package farver. November 20, 2018

Package vip. June 15, 2018

Paint/Draw Tools. Foreground color. Free-form select. Select. Eraser/Color Eraser. Fill Color. Color Picker. Magnify. Pencil. Brush.

Package EnQuireR. R topics documented: February 19, Type Package Title A package dedicated to questionnaires Version 0.

Package docxtools. July 6, 2018

EXAMINATIONS 2016 TRIMESTER 2

Package arphit. March 28, 2019

Package ggsubplot. February 15, 2013

A Step-by-step guide to creating a Professional PowerPoint Presentation

Package cli. November 5, 2017

Package waterfall. R topics documented: February 15, Type Package. Version Date Title Waterfall Charts in R

Package r2d2. February 20, 2015

Package utf8. May 24, 2018

Package sfdct. August 29, 2017

Tutorial 1 Engraved Brass Plate R

1 Some easy lines (2, 17) (10, 17) (18, 2) (18, 14) (1, 5) (8, 12) Check with a ruler. Are your lines straight?

Package fastdummies. January 8, 2018

Package VennDiagram. February 15, 2013

Package jdx. R topics documented: January 9, Type Package Title 'Java' Data Exchange for 'R' and 'rjava'

Package multigraph. R topics documented: January 24, 2017

WPF PUZZLE GP 2015 COMPETITION BOOKLET ROUND 3. Puzzle author: Turkey Serkan Yürekli. Organised by

The LDheatmap Package

DATA VISUALIZATION WITH GGPLOT2. Grid Graphics

Producing a Depth-Converted Seismic Horizon in Z-map

Package geogrid. August 19, 2018

Plot Input Files for Ternary and Binary Plots DDBSP Dortmund Data Bank Software Package

Package rplotengine. R topics documented: August 8, 2018

Package clustering.sc.dp

A QUICK TOUR OF ADOBE ILLUSTRATOR CC (2018 RELEASE)

Designing effective scientific figures Introduction to Inkscape to finalise figures

Marionette nodes - Vol. 1

Package transformr. December 9, 2018

Package abf2. March 4, 2015

Package basictrendline

Revision Topic 11: Straight Line Graphs

Package curvhdr. April 16, 2017

Package mixphm. July 23, 2015

ADOBE ILLUSTRATOR CS3

Package spark. July 21, 2017

Package d3plus. September 25, 2017

Package canvasxpress

Package lxb. R topics documented: August 29, 2016

XDesign Version User Guide

Working with grid Viewports

Microsoft Office Word 2010

Package Numero. November 24, 2018

Java How to Program, 9/e. Copyright by Pearson Education, Inc. All Rights Reserved.

Modifying grid grobs

Package lvplot. August 29, 2016

Package seg. February 15, 2013

Package ggrepel. September 30, 2017

Flying Start AS Computer Science. September 2015

Package gmt. September 12, 2017

Designer Reference 1

Package multigraph. R topics documented: November 1, 2017

Package balance. October 12, 2018

D-Cut Master MANUAL NO. OPS639-UM-153 USER'S MANUAL

StreamServe Persuasion SP4 PageIN

Package OLScurve. August 29, 2016

Adobe Photoshop Sh S.K. Sublania and Sh. Naresh Chand

Package Grid2Polygons

Package manet. September 19, 2017

Package cowplot. March 6, 2016

Package hextri. April 22, 2016

Package ggimage. R topics documented: December 5, Title Use Image in 'ggplot2' Version 0.1.0

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package surveyeditor

Working with grid Viewports

Shape and Line Tools. tip: Some drawing techniques are so much easier if you use a pressuresensitive

Package orderbook. R topics documented: February 20, Type Package Title Orderbook visualization/charting software

Package acss. February 19, 2015

Transcription:

Version 0.9-0 Depends R (>= 3.0.0), methods, grid, XML Suggests lattice, cluster, colorspace, survival SystemRequirements ghostscript Title Importing Vector Graphics Package grimport February 20, 2015 Functions for converting, importing, and drawing PostScript pictures in R plots. License GPL (>= 2) Author [aut, cre], Richard Walton [aut], Simon Potter [ctb] Maintainer <p.murrell@auckland.ac.nz> NeedsCompilation no Repository CRAN Date/Publication 2013-12-11 20:59:51 R topics documented: drawpath.......................................... 2 explodepaths........................................ 2 grid.picture......................................... 3 grid.symbols......................................... 4 grobify............................................ 5 picture............................................ 6 Picture-class......................................... 7 PictureChar-class...................................... 8 PictureFill-class....................................... 9 PictureOp-class....................................... 10 picturepaths......................................... 10 PictureStroke-class..................................... 11 PictureSummary-class................................... 12 PictureText-class...................................... 13 1

2 explodepaths PostScriptTrace....................................... 14 readpicture......................................... 15 symbolize.......................................... 15 Index 17 drawpath Draw a Picture Object This is a generic function that does the hard work for picture when drawing paths of a "Picture" object as part of the current plot. drawpath(p, trans,...) p trans A "Picture" object. A function that takes two arguments, x and y, and can be used to transform the locations on a path into sensible coordinates within the current plot.... Other arguments, typically graphical parameters. picture and grid.picture explodepaths Explode Complex Picture Paths This function converts complex paths within a "Picture" object (paths that contain more than one move operation) into multiple simple paths (paths with only one move operation). explodepaths(picture)

grid.picture 3 picture A "Picture" object. Value A "Picture" object. grid.picture grid.picture Draw a Picture Object These function take a "Picture" object and either draw the picture or create a grid graphical object representing the picture. grid.picture(...) picturegrob(picture, x = 0.5, y = 0.5, width = 1, height = 1, just = "centre", exp = 0.05, xscale = NULL, yscale = NULL, distort = FALSE, FUN = grobify,..., name = NULL, gp = gpar()) picture x y width height just A "Picture" object. A single numeric value or unit object specifying an x-value. A single numeric value or unit object specifying a y-value. A single numeric value or unit object specifying a width. A single numeric value or unit object specifying a height. The justification of the picture relative to its (x, y) location. If there are two values, the first value specifes horizontal justification and the second value specifies vertical justification. Possible string values are: "left", "right", "centre", "center", "bottom", and "top". For numeric values, 0 means left alignment and 1 means right alignment.

4 grid.symbols exp xscale yscale distort FUN An expansion factor; determines whether any space is left between the extent of the picture and the bounding rectangle it is drawn within. A numeric vector of length two indicating the minimum and maximum on the x-scale. A numeric vector of length two indicating the minimum and maximum on the y-scale. A logical value indicating whether the image should preserve its aspect ratio or distort to fit the area it is being drawn within. The function used to convert paths within the picture to grid grobs.... For grid.picture arguments to be passed to picturegrob. For picturegrob, arguments to be passed to grobify. name gp A character identifier. An object of class gpar, typically the output from a call to the function gpar. This is basically a list of graphical parameter settings. Value A grid gtree. grobify and grid.symbols grid.symbols Draw a Picture Object These function take a "Picture" object and either draw the picture at several locations or create a grid graphical object representing the picture (drawn at several locations). grid.symbols(...) symbolsgrob(picture, x = unit(0.5, "npc"), y = unit(0.5, "npc"), size = unit(1, "npc"), units = "npc",..., name = NULL, gp = gpar())

grobify 5 picture x y size units A "Picture" object. A numeric vector or unit object specifying x-values. A numeric vector or unit object specifying y-values. A numeric vector or unit object specifying symbol size. The default units to use if x, y, or size are specified as simple numeric values.... For grid.symbols arguments to be passed to symbolsgrob. For symbolsgrob, arguments to be passed to symbolize. name gp A character identifier. An object of class gpar, typically the output from a call to the function gpar. This is basically a list of graphical parameter settings. Value A grid gtree. symbolize and grid.picture grobify Convert a Picture into a Grid Grob Converts an entire "Picture" object, or a path element thereof, into an appropriate grid grob. Not usually called directly by the user; usually called by grid.picture. grobify(object,...) oldgrobify(object,...) object A "Picture" object.... passed on to the relevant grid grob constructor function.

6 picture Value A grid gtree (when given a whole "Picture") or an appropriate grid grob (when given a single picture path). grid.picture and symbolize picture Draw a Picture Object This function take a "Picture" object and draw it in the current plot region. picture(picture, xleft, ybottom, xright, ytop,...) picture xleft ybottom xright ytop Details A "Picture" object. The location for the left edge of the picture. The location for the bottom edge of the picture. The location for the right edge of the picture. The location for the top edge of the picture.... graphical parameters. The positions supplied, i.e., xleft,..., are relative to the current plotting region. If the x-axis goes from 100 to 200 then xleft should be larger than 100 and xright should be less than 200. readpicture and grid.picture

Picture-class 7 Picture-class Class "Picture" A collection of paths (polylines or polygons) that together describe a picture. Objects from the Class Objects can be created by calls of the form new("picture",...). ~~ describe objects here ~~ Slots paths: A list of objects of class "PictureStroke" (polylines) or "PictureFill" (polygons). summary: Object of class "PictureSummary" Methods [ signature(x = "Picture"): subset the paths of a picture to produce a new picture (includeing a new, updated summary). [[ signature(x = "Picture"): extract either a single path or, more usefully, the sub-paths of a "PictureText" object, to produce a new picture (includeing a new, updated summary). grobify signature(object = "Picture"): convert a picture into a grid grob (for use as a one-off image). symbolize signature(object = "Picture"): convert a picture into a grid grob (for use as a plotting symbol). readpicture, grid.picture, grid.symbols and PictureStroke-class PictureFill-class PictureSummary-class.

8 PictureChar-class PictureChar-class Class "PictureChar" A description of a polygon path that describes the outline of a character (and might be part of a larger picture). Slots x: Object of class "numeric" y: Object of class "numeric" rgb: Object of class "character" that specifies the fill colour for the polygon. lwd: Object of class "numeric" that specifies the line width of the polygon (only used if the character outline is stroked). char: Object of class "character" that specifies the character that this path represents. Extends Class "PictureOp", directly. Methods grobify signature(object = "PictureChar"): convert to a grid grob (for one-off drawing). Use argument filltext to fill the text rather than just stroke the outline. In that case, the first path for this character is filled in the appropriate colour and all subsequent paths are filled using a colour controlled by the bgtext argument (default is white). symbolize signature(object = "PictureChar"): convert to a grid grob (for drawing as a data symbol). Currently draws nothing. drawpath signature(object = "PictureChar"): draws a traced character path as part of the current plot. Picture-class, PictureStroke-class, and grid.picture, grid.symbols.

PictureFill-class 9 PictureFill-class Class "PictureFill" A description of a polygon path (that might be part of a larger picture). Slots x: Object of class "numeric" y: Object of class "numeric" rgb: Object of class "character" that specifies the fill colour for the polygon. lwd: Object of class "numeric" that specifies the line width of the polygon (not typically used because the polygon is meant to be filled not stroked). rule: Object of class "character" with the value evenodd or nonzero indicating the fill rule for the path. Extends Class "PictureOp", directly. Methods grobify signature(object = "PictureFill"): convert to a grid grob (for one-off drawing). There is a logical argument use.gc which can be used to turn off the graphics context coming from the object so that a different one can be specified via the gp argument. symbolize signature(object = "PictureFill"): convert to a grid grob (for drawing as a data symbol). drawpath signature(object = "PictureFill"): draws a traced polygonx as part of the current plot. Picture-class, PictureStroke-class, and grid.picture, grid.symbols.

10 picturepaths PictureOp-class Class "PictureOp" A virtual class from which "PictureStroke" and "PictureFill" are derived. Slots x: Object of class "numeric" y: Object of class "numeric" rgb: Object of class "character" giving colour information for the path. lty: Object of class "numeric" giving line type information for the path. lwd: Object of class "numeric" giving line width information for the path. lineend: Object of class "numeric" giving the type of line end style (round, butt, square). linejoin: Object of class "numeric" giving the type of line join style (round, mitre, bevel). linemitre: Object of class "numeric" giving the line mitre limit (as a number greater than 1). PictureStroke-class and PictureFill-class. picturepaths Draw Individual Picture Paths This function individually draws each path from a "Picture" object. picturepaths(picture, nr, nc, col = "black", fill = "light grey", freescales = FALSE, xscale = NULL, yscale = NULL, label = function(n) { tg <- textgrob(n, x = 0, y = 0, just = c("left", "bottom"),

PictureStroke-class 11 gp = gpar(fontsize = 6)) grid.rect(x = 0, y = 0, height = unit(6, "points"), width = grobwidth(tg), just = c("left", "bottom"), gp = gpar(fill = "white")) grid.draw(tg) }, use.gc = TRUE) picture nr nc col fill freescales xscale yscale label use.gc A "Picture" object. Number of rows of paths to draw. Number of columns of paths to draw. Colour of border drawn around each path. Background colour drawn behind each path. A boolean indicating whether each path should be drawn on its own scale. If FALSE, all paths are drawn on a common scale. If TRUE, xscale and yscale are ignored. A numeric vector of length two indicating the minimum and maximum on the x-scale. A numeric vector of length two indicating the minimum and maximum on the y-scale. Function to draw a label on each path. If any value other than a function is specified, no labels are drawn. A boolean indicating whether to use the graphical parameter information in the path. grid.picture PictureStroke-class Class "PictureStroke" A polyline path (that might be part of a larger picture).

12 PictureSummary-class Slots x: Object of class "numeric" y: Object of class "numeric" rgb: Object of class "character" giving the colour of the polyline. lwd: Object of class "numeric" giving the width of the polyine. Extends Class "PictureOp", directly. Methods grobify signature(object = "PictureStroke"): convert into a grid grob (for one-off drawing). There is a logical argument use.gc which can be used to turn off the graphics context coming from the object so that a different one can be specified via the gp argument. symbolize signature(object = "PictureStroke"): convert into a grid grob (for drawing as a data symbol)). drawpath signature(object = "PictureStroke"): draws a traced line as part of the current plot. Picture-class, PictureFill-class, and grid.picture, grid.symbols. PictureSummary-class Class "PictureSummary" Slots Summary information about a picture such as the number of paths and bounding box information. numpaths: Object of class "numeric" xscale: Object of class "numeric" range of x-values in picture. yscale: Object of class "numeric" range of y-values in picture. Picture-class

PictureText-class 13 PictureText-class Class "PictureText" Slots A description of a piece of text to draw, at a particular location and a particular size (and it might be part of a larger picture). Extends string: Object of class "character" x: Object of class "numeric" y: Object of class "numeric" w: Object of class "numeric" angle: Object of class "numeric" rgb: Object of class "character" that specifies the fill colour for the polygon. lwd: Object of class "numeric" that specifies the line width of the polygon (only used if the character outline is stroked). Class "PictureOp", directly. Methods grobify signature(object = "PictureText"): convert to a grid grob (for one-off drawing). In addition to a use.gc argument, there is a filltext argument to specify whether to stroke or fill text paths. Filling text paths is not necessarily a good idea because some characters have holes (e.g., the letter o ). The bgtext argument can be used to specify a colour to use to fill these holes; this argument can actually be a named vector of colours so that, e.g., the hole in an o is filled white, but the dot on an i is filled black. Finally, there is a sizebywidth argument which controls whether text is sized based on the traced width or based on the traced height of the original text. symbolize signature(object = "PictureText"): convert to a grid grob (for drawing as a data symbol). Currently draws nothing. drawpath signature(object = "PictureText"): draws a traced piece of text as part of the current plot. Picture-class, PictureChar-class, and grid.picture, grid.symbols.

14 PostScriptTrace PostScriptTrace Convert PostScript file to RGML file Converts a PostScript file into an RGML file, which is an XML document describing an image that can be read into R. PostScriptTrace(file, outfilename, charpath=true, charpos=false, setflat=null, defaultcol="black", encoding="iso-8859-1") file outfilename charpath charpos setflat defaultcol encoding The name of the PostScript file. The name of the XML document. A boolean indicating whether text in the PostScript file should be converted to vector outlines, or left as just text. A boolean indicating whether text in the PostScript file should be treated as individual characters, each with its own location. A number that controls how many straight lines a curve is broken into. Lower values break a curve into more lines. The default colour to use when grimport is unable to determine a colour for a path. This may occur when patterns are present in a PostScript image. A character value giving the encoding for the resulting RGML file. Details This function calls ghostscript to do the conversion, so will only work if ghostscript is installed on your system. If text is converted to outlines, it can be drawn as outlines, or filled using a crude algorithm which may or may not work (see grid.picture). On the other hand, if text is left as just text, font information is not stored so the text may not end up looking much like the original. Ghostscript is only going to emit text in a single-byte encoding, so the RGML file should have an explicit encoding (otherwise XML parsers are likely to assume UTF-8 and barf on any non-ascii text). The default encoding used is ISO-8859-1 (ISOLatin1), but you can specify another if you know that the source file has text that ghostscript will emit in a different encoding. There may have to be a bit of guesswork, or inspection of the source PostScript file. References http://www.cs.wisc.edu/~ghost/

readpicture 15 readpicture Import an RGML file This function reads in an RGML file (produced by PostScriptTrace) and creates a "Picture" object. readpicture(rgmlfile, tidy = TRUE,...) Value rgmlfile tidy The name of the RGML file. Boolean indicating whether to replace non-printing characters in string values with a full stop. The default is TRUE, which is just trying to keep you safe. But I strongly believe in the user s right to live dangerously.... that are passed to xmltreeparse() for reading the RGML file. An object of class "Picture". PostScriptTrace symbolize Convert a Picture into a Grid Grob Converts an entire "Picture" object, or a path element thereof, into an appropriate grid grob. Not usually called directly by the user; usually called by grid.picture. symbolize(object, x = unit(0.5, "npc"), y = unit(0.5, "npc"), size = unit(1, "npc"), units = "npc",...)

16 symbolize object x y Value size units A "Picture" object. A numeric vector or unit object specifying x-values. A numeric vector or unit object specifying y-values. A numeric vector or unit object specifying symbol size. The default units to use if x, y, or size are specified as simple numeric values.... passed on to the relevant grid grob constructor function. A grid gtree (when given a whole "Picture") or a "symbolfill" or "symbolstroke" object (when given a single picture path). grid.picture and symbolize

Index Topic classes Picture-class, 7 PictureChar-class, 8 PictureFill-class, 9 PictureOp-class, 10 PictureStroke-class, 11 PictureSummary-class, 12 PictureText-class, 13 Topic dplot drawpath, 2 explodepaths, 2 grid.picture, 3 grid.symbols, 4 grobify, 5 picture, 6 picturepaths, 10 PostScriptTrace, 14 readpicture, 15 symbolize, 15 [,Picture-method (Picture-class), 7 [[,Picture-method (Picture-class), 7 drawpath, 2 drawpath,picturechar-method (PictureChar-class), 8 drawpath,picturefill-method (PictureFill-class), 9 drawpath,picturestroke-method (PictureStroke-class), 11 drawpath,picturetext-method (PictureText-class), 13 explodepaths, 2 grid.picture, 2, 3, 3, 5 9, 11 13, 16 grid.symbols, 4, 4, 7 9, 12, 13 grobify, 4, 5 grobify,picture-method (Picture-class), 7 grobify,picturechar-method (PictureChar-class), 8 grobify,picturefill-method (PictureFill-class), 9 grobify,picturestroke-method (PictureStroke-class), 11 grobify,picturetext-method (PictureText-class), 13 oldgrobify (grobify), 5 oldgrobify,picturechar-method (PictureChar-class), 8 oldgrobify,picturefill-method (PictureFill-class), 9 oldgrobify,picturestroke-method (PictureStroke-class), 11 oldgrobify,picturetext-method (PictureText-class), 13 picture, 2, 6 Picture-class, 7 PictureChar-class, 8 PictureFill-class, 9 picturegrob (grid.picture), 3 PictureOp-class, 10 picturepaths, 10 PictureStroke-class, 11 PictureSummary-class, 12 PictureText-class, 13 PostScriptTrace, 14, 15 readpicture, 6, 7, 15 symbolize, 5, 6, 15, 16 symbolize,picture-method (Picture-class), 7 symbolize,picturechar-method (PictureChar-class), 8 symbolize,picturefill-method (PictureFill-class), 9 17

18 INDEX symbolize,picturestroke-method (PictureStroke-class), 11 symbolize,picturetext-method (PictureText-class), 13 symbolsgrob (grid.symbols), 4