View source: R/plot_source_detect.R
| plot.source_detection | R Documentation |
S3 plot method for objects of class "source_detection".
Produces a bar chart of the T-index for each source dataset, with
bars extending from a solid baseline at zero and a horizontal reference
line at the transferability threshold. Sources whose T-index falls
on or below the threshold are considered transferable.
## S3 method for class 'source_detection'
plot(
x,
fill_transferable = "white",
fill_nontransferable = "white",
color = "black",
linewidth = 0.5,
size.text = 3,
show.values = TRUE,
digits = 3,
base_size = 12,
threshold.linetype = "dashed",
threshold.color = "gray30",
...
)
x |
An object of class |
fill_transferable |
Fill color for transferable-source bars.
Default is |
fill_nontransferable |
Fill color for non-transferable-source bars.
Default is |
color |
Bar border color. Default is |
linewidth |
Bar border line width. Default is |
size.text |
Numeric; size of value labels on bars. Default is |
show.values |
Logical; if |
digits |
Integer; number of decimal places for displayed values.
Default is |
base_size |
Numeric; base font size passed to
|
threshold.linetype |
Linetype for the threshold reference line.
Default is |
threshold.color |
Color for the threshold reference line.
Default is |
... |
Additional arguments (currently unused). |
A ggplot object.
source_detection
set.seed(123)
target_data <- data.frame(
Y = rnorm(200), D = rnorm(200),
M1 = rnorm(200), M2 = rnorm(200), X1 = rnorm(200)
)
source1 <- data.frame(
Y = rnorm(300), D = rnorm(300),
M1 = rnorm(300), M2 = rnorm(300), X1 = rnorm(300)
)
source2 <- data.frame(
Y = rnorm(250), D = rnorm(250),
M1 = rnorm(250), M2 = rnorm(250), X1 = rnorm(250)
)
result <- source_detection(
target_data = target_data,
source_data = list(source1, source2),
Y = "Y", D = "D", M = c("M1", "M2"), X = "X1",
kfold = 5, verbose = FALSE
)
plot(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.