Learn R Programming

gglogo (version 0.1.5)

letterToPolygon: Convert an image file to a polygon

Description

Convert an image file to a polygon

Usage

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

Run this code
# NOT RUN {
library(ggplot2)
letter <- letterToPolygon("R", fontfamily="Helvetica")
qplot(x, y, geom="polygon", data = letter, fill=I("black"), alpha=I(0.8))+
     coord_equal()
# }

Run the code above in your browser using DataLab