# NOT RUN {
# }
# NOT RUN {
# create some temporary data
tmp.data <- data.frame(
x = c(
runif(n = 15, min = 0, max = 20),
runif(n = 15, min = 80, max = 100),
runif(n = 70, min = 0, max = 100)
),
y = c(
runif(n = 15, min = 0, max = 20),
runif(n = 15, min = 80, max = 100),
runif(n = 70, min = 0, max = 100)
)
);
# a simple scatterplot with correlation key
BoutrosLab.plotting.general::create.scatterplot(
formula = y ~ x,
data = tmp.data,
filename = paste0(tempdir(),'/get.corr.key-scatterplot.tiff'),
xlab.label = 'X Axis Title',
ylab.label = 'Y Axis Title',
xlimits = c(0,100),
ylimits = c(0,100),
xat = seq(0,100,25),
yat = seq(0,100,25),
add.axes = FALSE,
key = BoutrosLab.plotting.general::get.corr.key(
tmp.data$y,
tmp.data$x,
label.items = c('spearman', 'spearman.p', 'kendall', 'beta1', 'beta1.p')
)
);
# compare beta1 vs a robust estimate of the slope
# add an outlier
tmp.data <- rbind(tmp.data, c(2000,100));
BoutrosLab.plotting.general::create.scatterplot(
formula = y ~ x,
data = tmp.data,
filename = paste0(tempdir(),'/get.corr.key.robust-scatterplot.tiff'),
xlab.label = 'X Axis Title',
ylab.label = 'Y Axis Title',
xlimits = c(0,100),
ylimits = c(0,100),
xat = seq(0,100,25),
yat = seq(0,100,25),
add.axes = FALSE,
key = BoutrosLab.plotting.general::get.corr.key(
tmp.data$y,
tmp.data$x,
label.items = c('beta1', 'beta1.robust','beta1.p','beta1.robust.p')
)
);
# }
# NOT RUN {
# see create.scatterplot for an example of creating multiple keys using legends
# }
Run the code above in your browser using DataCamp Workspace