rule_euler | R Documentation |
Generates an Euler diagram visualization for up to 4 sets of association rules. The function displays the relationships between rule sets with customizable colors, transparency, and labels.
rule_euler(
rules,
fill_color = NULL,
fill_alpha = 0.5,
stroke_color = "black",
stroke_size = 1,
title = NULL,
name_color = "black",
name_size = 12,
text_color = "black",
text_size = 11,
show_legend = FALSE,
legend_position = "bottom",
nrow = NULL,
ncol = NULL
)
rules |
A list of |
fill_color |
A character vector of valid R color names or hex color codes for filling the sets.
If |
fill_alpha |
A numeric value between 0 and 1 specifying the transparency of the fill colors. Defaults to |
stroke_color |
A character string specifying the color of the set borders. Defaults to |
stroke_size |
A positive numeric value specifying the size of the set borders. Defaults to |
title |
A character string specifying the title of the Euler diagram. Defaults to |
name_color |
A character string specifying the color of the set names. Defaults to |
name_size |
A positive numeric value specifying the font size of the set names. Defaults to |
text_color |
A character string specifying the color of the quantity labels (counts) in the diagram. Defaults to |
text_size |
A positive numeric value specifying the font size of the quantities (counts). Defaults to |
show_legend |
A logical value indicating whether to display a legend for the sets rather than labels. Defaults to |
legend_position |
A character string specifying the position of the legend. Must be one of |
nrow |
An optional numeric value specifying the number of rows in the legend layout. If |
ncol |
An optional numeric value specifying the number of columns in the legend layout. If |
A plot
object displaying the Euler diagram visualization.
library(arules)
data(BrookTrout)
# Discretize the BrookTrout dataset
discrete_bt <- dtize_df(BrookTrout, cutoff = "median")
# Generate the first set of rules with a confidence threshold of 0.5
rules1 <- apriori(
discrete_bt,
parameter = list(supp = 0.01, conf = 0.5, target = "rules")
)
# Generate the second set of rules with a higher confidence threshold of 0.6
rules2 <- apriori(
discrete_bt,
parameter = list(supp = 0.01, conf = 0.6, target = "rules")
)
# Create an Euler diagram to visualize the intersections between the rule sets
rule_euler(
rules = list(conf0.5 = rules1, conf0.6 = rules2),
title = "Euler Diagram of BrookTrout Rule Sets",
fill_color = c("#7832ff", "lightgreen"),
stroke_color = "darkblue"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.