Code
rm(list=ls())
library(tidyverse)
library(tidyr)
library(lubridate) #helps wrangle date attributes
library(data.table) #for loading and mapping data
library(htmlwidgets)
library(plotly)
library(patchwork)
library(stringr)
MLA에650nm 레이져를 통과시킨 후 초점거리를 달리하여 투과율 측정한 내용을 시각화함
rm(list=ls())
library(tidyverse)
library(tidyr)
library(lubridate) #helps wrangle date attributes
library(data.table) #for loading and mapping data
library(htmlwidgets)
library(plotly)
library(patchwork)
library(stringr)
<- getwd()
dir
## 여러 csv 파일 불러오기
<- paste0(dir, "./data/") ## Working directory setting
path
list.files(path) ## file list
[1] "z_50_650.csv" "z_53_650.csv" "z_56_650.csv"
<-list.files(path,pattern = "csv") ## file list
file_list file_list
[1] "z_50_650.csv" "z_53_650.csv" "z_56_650.csv"
for (i in 1:length(file_list)){
print(i)
assign(paste0(substr(file_list[i], 1, 8)),
read_csv(paste0(path,file_list[i]), skip = 1, col_names = F))
}
[1] 1
[1] 2
[1] 3
<- plot_ly(showscale = FALSE)
fig
<- fig %>% add_surface(z = ~ as.matrix(z_50_650))
fig <- fig %>% add_surface(z = ~as.matrix(z_53_650+20), opacity = 0.7)
fig <- fig %>% add_surface(z = ~as.matrix(z_56_650+40), opacity = 0.7)
fig
fig
saveWidget(ggplotly(fig), file = "myplot.html")
require(akima)
require(rgl)
plot.new()
frame()
options(warn=-1) # 경고메세지 무시하기
par("mar")
[1] 5.1 4.1 4.1 2.1
par(mar = c(1,1,1,1))
par(fg = NA,col="black")
dev.off()
null device
1
#| echo = T
<-c(1:nrow(z_50_650))
tdn<-c(1:ncol(z_50_650))
rdn
filled.contour(x=tdn,
y=rdn,
z=as.matrix(z_50_650),
color.palette=colorRampPalette(c("blue","yellow","red")),
plot.title=title(main=paste0("Transmittance as wavelength, λ = 650nm") , sub="Z = 5.0, 5.3, 5.6mm",
xlab="", ylab=""),
nlevels=50,
plot.axes = { axis(side = 1, at = tdn, labels = tdn, col.lab="white")
axis(side = 2, at = rdn, labels = rdn, col.lab="white") },
key.title=title(main="T(%)"),
key.axes = axis(4, seq(0, 8, by = 0.1)))
png(paste0(dir,"/images/", substr(file_list[i], 1, 8), ".png"), pointsize=10, width=3800, height=3400, res=600)
for (i in c(1:3)){
filled.contour(x=tdn,
y=rdn,
z=as.matrix(eval(parse(text=paste0("z_", 47+3*i, "_650")))),
color.palette=colorRampPalette(c("blue","yellow","red")),
plot.title=title(main=paste0("Transmittance as z, z=", substr(file_list[i], 3, 4), "mm") ,
sub= paste0("λ =",substr(file_list[i], 6, 8) ) ,
xlab="", ylab=""),
nlevels=50,
plot.axes = { axis(side = 1, at = tdn, labels = tdn, col.lab="white")
axis(side = 2, at = rdn, labels = rdn, col.lab="white") },
key.title=title(main="T(%)"),
key.axes = axis(4, seq(0, 8, by = 0.1)))
print(paste0("z_", 47+3*i, "_650"))
}
[1] "z_50_650"
[1] "z_53_650"
[1] "z_56_650"