| library(svglite) |
| |
| filename = 'Cs_amb_plom' |
| scale <- 100 # Scale compared to the Na_smoothest (for the arrows and text) |
| |
| 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 <- 1197 + 1 |
| arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*(3 + 2), table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*0.2, length = 0.05, code = 1, col = "#799B6F") |
| text(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*(5.2 + 2), bquote(atop(gamma["2,0"] * (Ba), 662 ~ keV)), col = "#799B6F", cex = 0.75) |
| |
| i <- 365 + 1 |
| arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*3, table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*0.2, length = 0.05, code = 1, col = "#799B6F") |
| text(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*5.2, bquote(atop(BS ~ gamma["2,0"] * (Ba), 184 ~ keV)), col = "#799B6F", cex = 0.75) |
| |
| i <- 150 + 1 |
| arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*13, table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*0.2, length = 0.05, code = 1, col = "#F9627D") |
| text(table$ChannelNumber[i], table$ImpulsesSmooth[i] + scale*15.2, bquote(atop("Raigs X", atop("Canal 150", 61 ~ keV))), col = "#F9627D", cex = 0.75) |
| } |
| |
| 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() |
| } |