# NOT RUN {
# }
# NOT RUN {
set.seed(253647)
# create test data
tmp.data <- data.frame(
x = c(
runif(n = 150, min = 0, max = 20),
runif(n = 150, min = 40, max = 60),
runif(n = 700, min = 0, max = 40)
),
y = c(
runif(n = 150, min = 0, max = 20),
runif(n = 150, min = 40, max = 60),
runif(n = 700, min = 0, max = 40)
)
);
main.plot <- create.densityplot(
x = list(
X = tmp.data$x,
Y = tmp.data$y
),
xlab.label = 'X Axis Title',
ylab.label = 'Y Axis Title',
xlimits = c(-50,150),
ylimits = c(0,0.03),
xat = seq(-50,150,50),
yat = seq(0,0.03,0.005),
description = 'Image description goes here'
);
secondary.plot <- create.densityplot(
x = list(
X = tmp.data$x,
Y = tmp.data$y
),
xlab.label = '',
ylab.label = '',
xlimits = c(50,75),
ylimits = c(0,0.015),
xat = seq(0,150,10),
yat = seq(0,0.015,0.005),
xaxis.tck = 0,
description = 'Image description goes here'
);
write.plot(
filename = paste0(tempdir(),'/write_plot_example.tiff'),
trellis.object = main.plot,
additional.trellis.objects = list(secondary.plot),
additional.trellis.locations = list(
xleft = 0.6,
ybottom = 0.5,
xright =0.97,
ytop = 0.9
),
resolution = 50 # Lowering resolution decreases file size
);
# }
Run the code above in your browser using DataCamp Workspace