This function produce different kinds of charts for the metis package. iIt requires a table in the Metis format. Each figure is accompanied with a csv table.
metis.chart( data, dataNorm = NULL, chartType = "bar", position = "stack", xData = "x", yData = "value", class = "class1", group = "scenario", classPalette = "classPalette1", classLabel = "classLabel1", color = NULL, xLabel = "xLabel", yLabel = "yLabel", facet_rows = NULL, facet_columns = NULL, ncolrow = 6, facetBGColor = "grey30", facetBorderColor = "black", facetLabelColor = "white", facetLabelSize = 24, scales = "fixed", useNewLabels = 0, units = "units", xBreaksMaj = 10, xBreaksMin = 5, yBreaksMajn = 5, yBreaksMinn = 10, sizeBarLines = 0.5, sizeLines = 1.5, yMax = NULL, yMin = NULL, sectorToOrder = NULL, sectorFromOrder = NULL, removeCols = NULL, bubbleSize = 10, sankeyAxis1 = NULL, sankeyAxis2 = NULL, sankeyAxis1Label = "axis1Label", sankeyAxis2Label = "axis2Label", sankeyGroupColor = NULL, printFig = T, fileName = "chart", title = NULL, dirOutputs = NULL, folderName = NULL, figWidth = 13, figHeight = 9, pdfpng = "png", sankeyLabelsOn = 1, xOrder = NULL, colOrder1 = NULL, colOrderName1 = NULL, colOrder2 = NULL, colOrderName2 = NULL, pointsOn = 1, pointsSize = 4, paletteRev = T, forceFacets = F, legendPosition = "right", theme_custom = NULL, panelBGcolor = NULL, plotBGcolor = "transparent", legendBGcolor = NULL )
data | Data table for charting |
---|---|
dataNorm | Normalized data to plot under actual data in bubble plots. Default = NULL, |
chartType | Type of chart: "bar", "line", "bubble", "sankey" |
position | Position in bar charts. "identity", "stack" or "dodge" |
xData | X axis data variable (dataframe or table column name). Default "x". |
yData | Y axis data variable (dataframe or table column name).Default "value" |
class | Class data variable (dataframe or table column name).Default "class1" |
group | Group (dataframe or table column name).Default "scenario" |
classPalette | Color palette to use for multiple classes. Must be a color palette eg. c("red","blue","green") or a metis.colors() palette eg. metis.colors()$pal_Basic. Default "classPalette1" |
classLabel | Label to be used for legend title. Default "classLabel1" |
color | A single color name for single class charts. Default NULL |
xLabel | X axis title. Default "xLabel" |
yLabel | Y axis title. Default "units" |
facet_rows | Data variable to be used for facet rows (dataframe or table column name).Default "region" |
facet_columns | Data variable to be used for facet columns (dataframe or table column name).Default "scenario" |
ncolrow | Number of columns or Rows for Faceted plots. |
facetBGColor | Facet background color. Default ="grey30", |
facetBorderColor | Default = "black" |
facetLabelColor | Facet title text color. Default= "white", |
facetLabelSize | Facet title text size. Default =1.5, |
scales | Fixed or free scales for multiple sankey plots. Default "fixed" |
useNewLabels | "1" or "0". Converts labels to title-case.Default 0 |
units | Data units. Default "units" |
xBreaksMaj | X axis major breaks. Default 10 |
xBreaksMin | X axis minor breaks. Default 5 |
yBreaksMajn | Y axis major breaks. Default 5 |
yBreaksMinn | Y axis minor breaks. Default 10 |
sizeBarLines | Bar plot line size. Default 0.5 |
sizeLines | Line plot line size. Default 1.5 |
yMax | Y axis max value |
yMin | Y axis min value |
sectorToOrder | Order of "to" column variables in bubble plots. Default = NULL, |
sectorFromOrder | Order of "from" column variables in bubble plots. Default = NULL, |
removeCols | Option to remove certain columns from bubble plots. Default = NULL, |
bubbleSize | Bubble plot bubble size. Default = 10, |
sankeyAxis1 | Sankey axis 1 data variable (dataframe or table column name). Default = NULL, |
sankeyAxis2 | Sankey axis 2 data variable (dataframe or table column name).Default = NULL, |
sankeyAxis1Label | Sankey axis 1 title data variable (dataframe or table column name).Default = "axis1Label", |
sankeyAxis2Label | Sankey axis 2 title variable (dataframe or table column name).Default = "axis2Label", |
sankeyGroupColor | Which axis variables will be used to color flow paths (One of the sankey axis). Default = NULL, |
printFig | Whether plot should be printed or not. Default = T, |
fileName | File name for plot to be saved. Default = "chart", |
title | Figure title. Default = NULL |
dirOutputs | Output directory to save figure. Default = paste(getwd(),"/outputs/Charts",sep Default = "") |
folderName | Foldername within output directory. Default=NULL, |
figWidth | Figure width. Default = 9, |
figHeight | Figure height. Default = 7, |
pdfpng | Whether to save plot as pdf or png. Choice between "pdf" or "png". Default = "png", |
sankeyLabelsOn | Turn on labels for sankey stratum categories. "1" or "0". Default =1 |
xOrder | Default = NULL, |
colOrder1 | Order for sankey column 1. Default = NULL, |
colOrderName1 | Column name with sankey variables for column order 1. Default = NULL, |
colOrder2 | Order for sankey column 1. Default = NULL, |
colOrderName2 | Column name with sankey variables for column order 1. Default = NULL, |
pointsOn | Include points on lines. Default = 1 |
pointsSize | ISize of points on line. Default = 4 |
paletteRev | Default =T |
forceFacets | Default =F. When you have one facet only and want to show that. |
legendPosition | Default ="right" |
theme_custom | Default = NULL, "theme_gray","theme_bw","theme_linedraw","theme_light", "theme_minimal","theme_classic","theme_void","theme_dark" |
panelBGcolor | Default = "white", Can also be "transparent" |
plotBGcolor | Default = "transparent", Can also be "transparent" |
legendBGcolor | Default = "white", Can also be "transparent" |
Returns the formatted data used to produce chart