blob: 62cabdc7b4c8128e6f0059387c5670bb61056424 [file] [log] [blame]
library(svglite)
filename = 'Co'
args = commandArgs(trailingOnly=TRUE)
table <- read.table(paste0('dades/', filename, '.txt'), sep="\t", dec='.', header=TRUE)
# Plot the data
plotall <- function() {
plot(table$ChannelNumber, table$Impulses, type="l", col="#EEEEFF", xlab="NĂºmero de canal", ylab="Comptes")
lines(table$ChannelNumber, table$ImpulsesSmooth, type="l")
# Add arrows and text labels to the peaks
i <- 2094 + 1
arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+14.6, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.64, length = 0.05, code = 1, col = "#514E7E")
text(table$ChannelNumber[i], table$ImpulsesSmooth[i]+20.64, bquote(atop(gamma["3,1"] * (Ni), 1173 ~ keV)), col = "#514E7E", cex = 0.75)
i <- 2362 + 1
arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+9.6, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.64, length = 0.05, code = 1, col = "#514E7E")
text(table$ChannelNumber[i], table$ImpulsesSmooth[i]+16.64, bquote(atop(gamma["1,0"] * (Ni), 1332 ~ keV)), col = "#514E7E", cex = 0.75)
i <- 409 + 1
arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+17.6, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.64, length = 0.05, code = 1, col = "#799B6F")
text(table$ChannelNumber[i], table$ImpulsesSmooth[i]+24.64, bquote(atop(BS ~ gamma["3,1"] * (Ni), 209 ~ keV)), col = "#799B6F", cex = 0.75)
i <- 417 + 1
arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+11.6, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.64, length = 0, col = "#799B6F")
arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+11.6, table$ChannelNumber[i]+100, table$ImpulsesSmooth[i]+11.6, length = 0.05, code = 2, col = "#799B6F")
text(table$ChannelNumber[i]+60, table$ImpulsesSmooth[i]+6.6, bquote(atop(BS ~ gamma["1,0"] * (Ni), 214 ~ keV)), col = "#799B6F", cex = 0.75, pos = 4)
}
pdf(paste0('output/', filename, '.pdf'), width = 6, height = 5)
plotall()
dev.off()
if (length(args) < 1 || args[1] != "preview") {
svg(paste0('output/', filename, '.svg'), width = 6, height = 5)
plotall()
dev.off()
}