Chart Generation for 'Microsoft Word' and 'Microsoft PowerPoint' Documents

Create native charts for 'Microsoft PowerPoint' and 'Microsoft Word' documents. These can then be edited and annotated. Functions are provided to let users create charts, modify and format their content. The chart's underlying data is automatically saved within the 'Word' document or 'PowerPoint' presentation. It extends package 'officer' that does not contain any feature for 'Microsoft' native charts production.

The mschart package provides a framework for easily create charts for ‘Microsoft PowerPoint’ documents. It has to be used with package officer that will produce the charts in new or existing PowerPoint or Word documents.

The user documentation can be read here.

Functions you should be aware of are documented here.

This is a basic example which shows you how to create a line chart.

linec <- ms_linechart(data = iris, x = "Sepal.Length",
                      y = "Sepal.Width", group = "Species")
linec <- chart_ax_y(linec, num_fmt = "0.00", rotation = -90)

Then use package officer to send the object as a chart.

doc <- read_pptx()
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme")
doc <- ph_with_chart(doc, chart = linec)
print(doc, target = "example.pptx")

At any moment, you can type print(your_chart, preview = TRUE) to preview the chart in a temporary PowerPoint file. This requires to have a PowerPoint Viewer installed on the machine.


You can get the development version from GitHub:


Or the latest version on CRAN:


Contributing to the package

Code of Conduct

Anyone getting involved in this package agrees to our Code of Conduct.

Bug reports

When you file a bug report, please spend some time making it easy for me to follow and reproduce. The more time you spend on making the bug report coherent, the more time I can dedicate to investigate the bug as opposed to the bug report.

Contributing to the package development

A great way to start is to contribute an example or improve the documentation.

If you want to submit a Pull Request to integrate functions of yours, please provide:

  • the new function(s) with code and roxygen tags (with examples)
  • a new section in the appropriate vignette that describes how to use the new function
  • add corresponding tests in directory tests/testthat.

By using rhub (run rhub::check_for_cran()), you will see if everything is ok. When submitted, the PR will be evaluated automatically on travis and appveyor and you will be able to see if something broke.


mschart 0.2.3


  • new function chart_labels_text() to customise text labels


  • fix issue 22 with grid lines and fp_border(style = "none").

mschart 0.2.2


  • htmlEscape characters to allow "&" and "<" symbols
  • num_fmt issues with %
  • add controls and fix chart_settings.ms_scatterchart


  • added argument legend_text to theme function
  • legend can be dropped now
  • ms_linechart now accept non numeric x axis.

mschart 0.2.1

  • Fix issue that made file corrupted when data has missing values

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.2.6 by David Gohel, 8 days ago,

Report a bug at

Browse source code at

Authors: David Gohel [aut, cre] , ArData [cph] , YouGov [fnd] , David Camposeco [ctb] (chart_data_smooth function)

Documentation:   PDF Manual  

Task views: Reproducible Research

MIT + file LICENSE license

Imports stats, data.table, officer, cellranger, writexl, grDevices, xml2, htmltools

See at CRAN