Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

chart_settings

set chart options


Description

Set chart properties.

Usage

chart_settings(x, ...)

## S3 method for class 'ms_barchart'
chart_settings(x, vary_colors, gap_width, dir, grouping, overlap, ...)

## S3 method for class 'ms_linechart'
chart_settings(x, vary_colors, ...)

## S3 method for class 'ms_areachart'
chart_settings(x, vary_colors = FALSE, grouping = "standard", ...)

## S3 method for class 'ms_scatterchart'
chart_settings(x, vary_colors = FALSE, scatterstyle = "lineMarker", ...)

Arguments

x

an ms_chart object.

...

unused parameter

vary_colors

if TRUE the data points in the single series are displayed the same color.

gap_width

A gap appears between the bar or clustered bars for each category on a bar chart. The default width for this gap is 150 percent of the bar width. It can be set between 0 and 500 percent of the bar width.

dir

the direction of the bars in the chart, value must one of "horizontal" or "vertical".

grouping

grouping for a barchart, a linechart or an area chart. must be one of "percentStacked", "clustered", "standard" or "stacked".

overlap

In a bar chart having two or more series, the bars for each category are clustered together. By default, these bars are directly adjacent to each other. The bars can be made to overlap each other or have a space between them using the overlap property. Its values range between -100 and 100, representing the percentage of the bar width by which to overlap adjacent bars. A setting of -100 creates a gap of a full bar width and a setting of 100 causes all the bars in a category to be superimposed. The default value is 0.

scatterstyle

The Style for the scatter chart. One of 'none', 'line', 'lineMarker', 'marker', 'smooth', 'smoothMarker'.

Methods (by class)

  • ms_barchart: barchart settings

  • ms_linechart: linechart settings

  • ms_areachart: linechart settings

  • ms_scatterchart: linechart settings

Illustrations

See Also

Examples

library(mschart)
library(officer)

chart_01 <- ms_barchart(
  data = browser_data, x = "browser",
  y = "value", group = "serie"
)
chart_01 <- chart_theme(chart_01,
  grid_major_line_x = fp_border(width = 0),
  grid_minor_line_x = fp_border(width = 0)
)

chart_02 <- chart_settings(
  x = chart_01,
  grouping = "stacked", overlap = 100
)


chart_03 <- ms_areachart(data = browser_ts, x = "date",
  y = "freq", group = "browser")
chart_03 <- chart_settings(chart_03,
  grouping = "percentStacked")

mschart

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

v0.3.0
MIT + file LICENSE
Authors
David Gohel [aut, cre], ArData [cph], YouGov [fnd], Rokas Klydzia [ctb] (custom labels), David Camposeco [ctb] (chart_data_smooth function), Dan Joplin [ctb] (fix scatter plot data structure)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.