blob: e86eda112d861a9713b776f718516d274a0e8196 [file] [log] [blame]
library(tikzDevice)
table <- read.table('dades/calibracio_ra.txt', sep="\t", dec='.', header=TRUE)
# Plot the data
plotall <- function() {
plot(table$ChannelNumber, table$Impulses, type="l", col="#EEEEFF", xlab="Nombre de canal", ylab="Comptes")
lines(table$ChannelNumber, table$ImpulsesSmooth, type="l")
# Add arrows and text labels to the peaks
for (j in 1:nrow(peaks)) {
i <- peaks[j, 'indexes']
label <- peaks[j, 'labels']
arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+3, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.1, length = 0.05, code = 1, col = "#514E7E")
text(table$ChannelNumber[i], table$ImpulsesSmooth[i]+4.6, paste0("Canal ", table$ChannelNumber[i], "\n", label), col = "#514E7E", cex = 0.75)
}
}
indexes <- c(1601, 2359, 3373) + 1
labels <- c("\\textsuperscript{226}Ra", "\\textsuperscript{218}Po", "\\textsuperscript{214}Po")
peaks <- data.frame(indexes, labels)
pdf('output/calibracio_ra.pdf', width = 6, height = 5)
plotall()
dev.off()
tikz('output/calibracio_ra.tex', width = 6, height = 5)
plotall()
dev.off()