blob: 54c0ef4402b64975945b9b42464dc2a016ff009c [file] [log] [blame]
library(tikzDevice)
nom <- 'Pic_Am'
scale <- 4
plotbg <- function(table, number) {
col1 = ""
col2 = ""
if (number == 0) {
col1 = "#073B4C"
col2 = "#C7EDFA"
}
if (number == 2) {
col1 = "#118AB2"
col2 = "#B4E7F8"
}
if (number == 4) {
col1 = "#06DBA2"
col2 = "#AFFDE8"
}
if (number == 6) {
col1 = "#FFC233"
col2 = "#FFF3D6"
}
if (number == 8) {
col1 = "#EF436B"
col2 = "#FAC7D3"
}
if (number == 10) {
col1 = "#8377D1"
col2 = "#E2E0F5"
}
if (number == 0) {
plot(table$Energy, table$Impulses, type="l", col=col2, xlab="Energia (keV)", ylab="Comptes")
} else {
lines(table$Energy, table$Impulses, type="l", col=col2, xlab="Energia (keV)", ylab="Comptes")
}
}
plotfg <- function(table, number) {
col1 = ""
col2 = ""
if (number == 0) {
col1 = "#073B4C"
col2 = "#C7EDFA"
}
if (number == 2) {
col1 = "#118AB2"
col2 = "#B4E7F8"
}
if (number == 4) {
col1 = "#06DBA2"
col2 = "#AFFDE8"
}
if (number == 6) {
col1 = "#FFC233"
col2 = "#FFF3D6"
}
if (number == 8) {
col1 = "#EF436B"
col2 = "#FAC7D3"
}
if (number == 10) {
col1 = "#8377D1"
col2 = "#E2E0F5"
}
lines(table$Energy, table$ImpulsesSmooth, col=col1, type="l")
}
pdf(paste0('output/', nom, '.pdf'), width = 6, height = 5)
numbers <- c(0:5)*2
for (number in numbers) {
table <- read.table(paste0('dades/', nom, '_', number, '.txt'), sep="\t", dec='.', header=TRUE)
plotbg(table, number)
}
for (number in numbers) {
table <- read.table(paste0('dades/', nom, '_', number, '.txt'), sep="\t", dec='.', header=TRUE)
plotfg(table, number)
}
legendColors = c("#073B4C", "#118AB2", "#06DBA2", "#FFC233", "#EF436B", "#8377D1")
legend("topright", inset = c(0.015, 0.03), col = legendColors, legend = c("Buit", "2 mangueres", "4 mangueres", "6 mangueres", "8 mangueres", "10 mangueres"), lty=c(1, 1, 1, 1, 1, 1))
dev.off()
tikz(paste0('output/', nom, '.tex'), width = 6, height = 5)
numbers <- c(0:5)*2
for (number in numbers) {
table <- read.table(paste0('dades/', nom, '_', number, '.txt'), sep="\t", dec='.', header=TRUE)
plotbg(table, number)
}
for (number in numbers) {
table <- read.table(paste0('dades/', nom, '_', number, '.txt'), sep="\t", dec='.', header=TRUE)
plotfg(table, number)
}
legendColors = c("#073B4C", "#118AB2", "#06DBA2", "#FFC233", "#EF436B", "#8377D1")
legend("topright", inset = c(0.015, 0.03), col = legendColors, legend = c("Buit", "2 mangueres", "4 mangueres", "6 mangueres", "8 mangueres", "10 mangueres"), lty=c(1, 1, 1, 1, 1, 1))
dev.off()