# NOT RUN {
# }
# NOT RUN {
set.seed(12345);
create.qqplot.comparison(
filename = paste0(tempdir(),'/QQcomparison_Simple.tiff'),
x = list(rnorm(100), rnorm(100))
);
# Minimal Input
create.qqplot.comparison(
filename = paste0(tempdir(),'/QQcomparison_Minimal_Input.tiff'),
x = list(microarray[1:500,2], microarray[1:500,2]),
main = 'Minimal input',
description = 'QQplot comparison created by BoutrosLab.plotting.general'
);
# Axes & Labels
create.qqplot.comparison(
filename = paste0(tempdir(),'/QQcomparison_Axes_Labels.tiff'),
x = list(microarray[1:500,2], microarray[1:500,2]),
main = 'Axes & labels',
# adding axes and labels
xlab.label = 'Sample 1',
ylab.label = 'Sample 2',
xlab.cex = 1.5,
ylab.cex = 1.5,
# adding grid for good measure
add.grid = TRUE,
description = 'QQplot comparison created by BoutrosLab.plotting.general'
);
# Formula input
# 'Formula' format of data
chr.locations <- microarray$Chr[1:500];
chr.locations <- replace(chr.locations, which(chr.locations == 1), 'Chromosome 1');
chr.locations <- replace(chr.locations, which(chr.locations == 2), 'Chromosome 2');
qqplot.data <- data.frame(
sample = c(rep('Sample 1', 500), rep('Sample 2', 500)),
value = c(microarray[1:500,1], microarray[1:500,2]),
chr = chr.locations
);
create.qqplot.comparison(
filename = paste0(tempdir(),'/QQcomparison_Formula.tiff'),
# Using a different input method
x = sample ~ value,
data = qqplot.data,
main = 'Formula input',
xlab.label = 'Sample 1',
ylab.label = 'Sample 2',
xaxis.lab = seq(0, 15, 5),
yaxis.lab = seq(0, 15, 5),
xlimits = c(0, 17),
ylimits = c(0, 17),
xlab.cex = 1.5,
ylab.cex = 1.5,
add.grid = TRUE,
description = 'QQplot comparison created by BoutrosLab.plotting.general'
);
# Groups & Legend
create.qqplot.comparison(
filename = paste0(tempdir(),'/QQcomparison_Groups_Legend.tiff'),
x = sample ~ value,
data = qqplot.data,
# Using fake grouping for the sake of illustration
groups = qqplot.data$chr,
# Set colours to differente the gruops
col = default.colours(3),
# Setting different plotting characters
pch = c(15, 16),
main = 'Groups & legend',
xlab.label = 'Sample 1',
ylab.label = 'Sample 2',
xlab.cex = 1.5,
ylab.cex = 1.5,
add.grid = TRUE,
# Adding legend to explain groups
key = list(
text = list(
lab = c('1','2'),
cex = 1.5,
col = 'black'
),
points = list(
pch = c(15, 16),
col = default.colours(2),
cex = 1
),
x = 0.04,
y = 0.95,
padding.text = 2
),
description = 'QQplot comparison created by BoutrosLab.plotting.general'
);
# Multiple qq plots
create.qqplot.comparison(
filename = paste0(tempdir(),'/QQcomparison_Multiple.tiff'),
x = sample ~ value | chr,
data = qqplot.data,
main = 'Multiple plots',
xlab.label = 'Sample 1',
ylab.label = 'Sample 2',
xlab.cex = 1.5,
ylab.cex = 1.5,
add.grid = TRUE,
description = 'QQplot comparison created by BoutrosLab.plotting.general'
);
# Nature style
create.qqplot.comparison(
filename = paste0(tempdir(),'/QQcomparison_Nature_style.tiff'),
x = sample ~ value,
data = qqplot.data,
main = 'Nature style',
xlab.cex = 1.5,
ylab.cex = 1.5,
add.grid = TRUE,
# set style to Nature
style = 'Nature',
# demonstrating how to italicize character variables
ylab.label = expression(paste('italicized ', italic('a'))),
# demonstrating how to create en-dashes
xlab.label = expression(paste('en dashs: 1','\u2013', '10'^'\u2013', ''^3)),
description = 'QQplot comparison created by BoutrosLab.plotting.general'
);
# }
Run the code above in your browser using DataCamp Workspace