letterToPolygon: Convert an image file to a polygon

Description Usage Arguments Examples

View source: R/text.r

Description

Convert an image file to a polygon

Usage

1
2
letterToPolygon(ch, fontfamily = "Helvetica", fontsize = 576, tol = 1,
  dim = c(480, 480), threshold = 0.5, var = "red")

Arguments

ch

letter

fontfamily

R has a few default fonts that are always available, such as e.g. Helvetica, Arial, Courier New, and Garamond. Other fonts might be available depending on the platform used.

fontsize

by default 576. If the resulting string exceeds the boundary of the matrix returned, reduced font size

tol

tolerance

dim

vector of length two specifying width and height (in pixels) of the temporary jpg file created for the letter. Defaults to 480 x 480 pixels.

threshold

numerical cutoff between 0 and 1

var

one of "red", "green", "blue".

Examples

1
2
3
4
library(ggplot2)
letter <- letterToPolygon("R", fontfamily="Helvetica")
qplot(x, y, geom="polygon", data = letter, fill=I("black"), alpha=I(0.8))+
     coord_equal()

gglogo documentation built on May 30, 2017, 3:40 a.m.

Search within the gglogo package
Search all R packages, documentation and source code