| generateMoboPlot | R Documentation |
This function generates a multi-objective optimization plot using ggplot2. The plot visualizes the relationship between the x and y variables, grouping and coloring by a fill variable, with the option to customize legend position, labels, and annotation of sampling and optimization phases.
generateMoboPlot(
data,
x,
y,
fillColourGroup = "ConditionID",
ytext,
legendPos = c(0.65, 0.85),
numberSamplingSteps = 5,
labelPosFormulaY = "top",
verticalLinePosY = 0.75
)
data |
A data frame containing the data to be plotted. |
x |
A string representing the column name in |
y |
A string representing the column name in |
fillColourGroup |
A string representing the column name in |
ytext |
A custom label for the y-axis. If not provided, the y-axis label will be the title-cased version of |
legendPos |
A numeric vector of length 2 specifying the position of the legend inside the plot. Default is |
numberSamplingSteps |
An integer specifying the number of initial sampling steps before the optimization phase begins. Default is 5. |
labelPosFormulaY |
A string specifying the vertical position of the polynomial equation label in the plot. Acceptable values are |
verticalLinePosY |
A numeric value of the y-coordinate where the "sampling" and "optimization" line should be drawn. |
A ggplot object representing the multi-objective optimization plot, ready to be rendered.
library(ggplot2)
library(ggpmisc)
# Example with numeric x-axis
df <- data.frame(
x = 1:20,
y = rnorm(20),
ConditionID = rep(c("A", "B"), 10)
)
generateMoboPlot(df, x = "x", y = "y")
# Example with factor x-axis
df <- data.frame(
x = factor(rep(1:5, each = 4)),
y = rnorm(20),
ConditionID = rep(c("A", "B"), 10)
)
generateMoboPlot(df, x = "x", y = "y", numberSamplingSteps = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.