rAmCharts - amMekko

Parameters

  • x: a character, column name for x-axis.
  • y: a character, column name for y-axis.
  • data: a dataframe with values to display. See data_mekko for example.
  • groups_color: character, a vector of colors in hexadecimal, same length as the number of y modalities.
  • xlab: a character, label for x-axis.
  • ylab: a character, label for y-axis.
  • horiz: a boolean, TRUE for an horizontal chart, FALSE for a vertical one.
  • show_values: a boolean, TRUE to display values.
  • : other parameters called in amOptions.

Data used in the examples:

data("data_mekko")
head(data_mekko)
##   var1 var2
## 1   A1   B5
## 2   A1   B4
## 3   A1   B5
## 4   A1   B5
## 5   A1   B4
## 6   A1   B1

Reference example

amMekko(x = "var1", y = "var2", data = data_mekko)

Horizontal chart

amMekko(x = "var1", y = "var2", data = data_mekko, horiz = TRUE)

Display values

amMekko(x = "var1", y = "var2", data = data_mekko, show_values = TRUE)

amOptions

legend

amMekko(x = "var1", y = "var2", data = data_mekko, legend = TRUE)
#or
amMekko(x = "var1", y = "var2", data = data_mekko) %>>% 
  amOptions(legend = TRUE)

legendPosition

amMekko(x = "var1", y = "var2", data = data_mekko, legend = TRUE, legendPosition = "left")
#or
amMekko(x = "var1", y = "var2", data = data_mekko) %>>% 
  amOptions(legend = TRUE, legendPosition = "left")

export

amMekko(x = "var1", y = "var2", data = data_mekko, export = TRUE)
#or
amMekko(x = "var1", y = "var2", data = data_mekko) %>>% 
  amOptions(export = TRUE)

exportFormat

amMekko(x = "var1", y = "var2", data = data_mekko, export = TRUE, exportFormat = "JPG")
#or
amMekko(x = "var1", y = "var2", data = data_mekko) %>>% 
  amOptions(export = TRUE, exportFormat = "JPG")

main and creditsPosition

amMekko(x = "var1", y = "var2", data = data_mekko, main = "My Mekko",
        mainColor = "#68838B", mainSize = 25, creditsPosition = "bottom-left")
#or
amMekko(x = "var1", y = "var2", data = data_mekko) %>>% 
  amOptions( main = "My Mekko",
        mainColor = "#68838B", mainSize = 25, creditsPosition = "bottom-left")

theme

amMekko(x = "var1", y = "var2", data = data_mekko, theme = "patterns")
#or
amMekko(x = "var1", y = "var2", data = data_mekko) %>>% 
  amOptions(theme = "patterns")