Giter Club home page Giter Club logo

rvg's Introduction

rvg package

R-CMD-check version cranlogs

rvg is providing two graphics devices that produces Vector Graphics outputs in DrawingML format for Microsoft PowerPoint with dml_pptx and for Microsoft Excel with dml_xlsx. Theses formats let users edit the graphic elements (editable graphics) within PowerPoint or Excel and have a very good rendering.

These raw XML outputs cannot be used as is. Functions dml and ph_with() have to be used with package officer to add vector graphics in PowerPoint documents (dml function is a simple wrapper to mark the plot instructions as Vector Graphics instructions).

library(rvg)
library(ggplot2)
library(officer)

my_vec_graph <- dml(code = barplot(1:5, col = 2:6))

doc <- read_pptx()
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme")
doc <- ph_with(doc, my_vec_graph, location = ph_location_fullsize() )
print(doc, target = "my_plot.pptx")

Function xl_add_vg() is the equivalent for Excel workbooks.

doc <- read_xlsx()
doc <- xl_add_vg(doc, sheet = "Feuil1", code = print(gg), 
  width = 6, height = 6, left = 1, top = 2 )
print(doc, target = "vg.xlsx")

By default, theses graphics are editable, element edition can be disabled with option editable = FALSE.

Installation

You can get the development version from GitHub:

devtools::install_github("davidgohel/rvg")

Install the CRAN version:

install.packages("rvg")

rvg's People

Contributors

davidgohel avatar

Watchers

James Cloos avatar CRAN robot avatar  avatar

Forkers

gerardo-ml

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.