MyNixOS website logo
Description

An Easy SVG Basic Elements Generator.

This SVG elements generator can easily generate SVG elements such as rect, line, circle, ellipse, polygon, polyline, text and group. Also, it can combine and output SVG elements into a SVG file.

easySVG package

The R package 'easySVG' can generate SVG elements easily.

Introduction

This package is an easy SVG elements generator. It can easily generate svg elements such as rect, line, circle, ellipse, polygon polyline, text and make group. Also, it can output svg elements into a svg file.

Installation

Github

# Install the cutting edge development version from GitHub:
# install.packages("devtools")
devtools::install_github("ytdai/easySVG")

Zip/Tarball

  1. Download the appropriate zip file or tar.gz file from Github
  2. Unzip the file and change directories into the easySVG directory
  3. Run R CMD INSTALL pkg

Basic usage

library(easySVG)

line.1 <- line.svg(x1 = 50, y1 = 20, x2 = 150, y2 = 20)
message(line.1)

line.2 <- line.svg(x1 = 50, y1 = 40, x2 = 150, y2 = 40, stroke = "red", stroke.width = 3)
message(line.2)

rect.1 <- rect.svg(x = 50, y = 60, width = 100, height = 10, fill = "blue")
message(rect.1)

rect.2 <- rect.svg(x = 50, y = 80, width = 100, height = 5, fill = "yellow", stroke = "none")
message(rect.2)

circle.1 <- circle.svg(cx = 80, cy = 100, r = 10, fill = "blue")
message(circle.1)

circle.2 <- circle.svg(cx = 120, cy = 100, r = 5, fill = "red", stroke = "none")
message(circle.2)

ellipse.1 <- ellipse.svg(cx = 100, cy = 120, rx = 20, ry = 5, fill = "blue")
message(ellipse.1)

points <- matrix(c( 50, 100, 120, 140, 135, 145), nrow = 3, ncol = 2)

polygon.1 <- polygon.svg(points = points, fill = "green", stroke = "none")
message(polygon.1)

points <- matrix(c( 50, 100, 120, 160, 155, 165), nrow = 3, ncol = 2)

polyline.1 <- polyline.svg(points = points)
message(polyline.1)

text <- c("line.1", "line.2", "rect.1 - rect.2",
          "circle.1", "circle.2", "ellipse.1",
          "polygon.1", "polyline.1")

text.elements <- lapply(1:length(text), 
                        function(x) get.text.svg(x = 10, y = 20*x, text.content = text[x], font.size = 6))

text.elements <- unlist(text.elements)

content <- list(line.1, line.2, rect.1, rect.2,
                circle.1, circle.2, ellipse.1,
                polygon.1, polyline.1, text.elements)
pack.svg(width = 200, height = 200, pack.content = content, output.svg.name = "eleSVG.svg")

Metadata

Version

0.1.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows