Adrià Vilanova MartÃnez | 42b8a89 | 2023-03-21 00:18:28 +0100 | [diff] [blame] | 1 | library(tikzDevice) |
| 2 | |
| 3 | table <- read.table('dades/calibracio_ra.txt', sep="\t", dec='.', header=TRUE) |
| 4 | |
| 5 | # Plot the data |
| 6 | plotall <- function() { |
| 7 | plot(table$ChannelNumber, table$Impulses, type="l", col="#EEEEFF", xlab="Nombre de canal", ylab="Comptes") |
| 8 | lines(table$ChannelNumber, table$ImpulsesSmooth, type="l") |
| 9 | |
| 10 | # Add arrows and text labels to the peaks |
| 11 | for (j in 1:nrow(peaks)) { |
| 12 | i <- peaks[j, 'indexes'] |
| 13 | label <- peaks[j, 'labels'] |
| 14 | arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+3, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.1, length = 0.05, code = 1, col = "#514E7E") |
| 15 | text(table$ChannelNumber[i], table$ImpulsesSmooth[i]+4.6, paste0("Canal ", table$ChannelNumber[i], "\n", label), col = "#514E7E", cex = 0.75) |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | indexes <- c(1601, 2359, 3373) + 1 |
| 20 | labels <- c("\\textsuperscript{226}Ra", "\\textsuperscript{218}Po", "\\textsuperscript{214}Po") |
| 21 | peaks <- data.frame(indexes, labels) |
| 22 | |
| 23 | pdf('output/calibracio_ra.pdf', width = 6, height = 5) |
| 24 | plotall() |
| 25 | dev.off() |
| 26 | |
| 27 | tikz('output/calibracio_ra.tex', width = 6, height = 5) |
| 28 | plotall() |
| 29 | dev.off() |