diff --git a/app/helper.R b/app/helper.R index bf3b452..62df6f3 100644 --- a/app/helper.R +++ b/app/helper.R @@ -33,3 +33,23 @@ identify_bullet <- function(words) { samelist <- samelist %>% purrr::list_transpose() make.names(paste(samelist[[1]], collapse="")) # delete all forbidden characters } + + +groove_plot <- function(ccdata, grooves) { + ccdata %>% + ggplot(aes(x = x, y = value)) + + theme_bw()+ + geom_vline(xintercept = 0, colour = "blue") + + geom_vline(xintercept = grooves[2]-grooves[1], colour = "blue") + + geom_line(linewidth = 1) + # put signal in front + scale_x_continuous( + breaks=c(0,round(as.numeric(grooves[2]-grooves[1]),0),round(seq(min(ccdata$x),max(ccdata$x),by=500),-2))) + + xlab("Position along width of Land [µm]") + + ylab("Surface Height [µm]") + + theme( + axis.text=element_text(size=16), + axis.title=element_text(size=18), + plot.title = element_text(size=22,face="bold") + #axis.text.x = element_text(angle = 90, hjust = 1) + ) +} diff --git a/app/server.R b/app/server.R index 0d429a8..1c44b84 100644 --- a/app/server.R +++ b/app/server.R @@ -469,40 +469,13 @@ server <- function(input, output, session) { CCDataL <- BullCompBulls$ccdata[[GroovePlotLidx]] - GroovesL[1] CCDataR <- BullCompBulls$ccdata[[GroovePlotRidx]] - GroovesR[1] output[[paste0("GroovePlotL",idx)]] = renderPlot({ - CCDataL %>% - ggplot(aes(x = x, y = value)) + - geom_line() + - theme_bw()+ - geom_vline(xintercept = 0, colour = "blue") + - geom_vline(xintercept = GroovesL[2]-GroovesL[1], colour = "blue") + - scale_x_continuous(breaks=c(0,round(as.numeric(GroovesL[2]-GroovesL[1]),0),round(seq(min(CCDataL$x),max(CCDataL$x),by=500),-2))) + - xlab("Position along width of Land [µm]") + - ylab("Surface Height [µm]") + - ggtitle(paste0("Location of the grooves in Land : ",bsldata$land1[odridx[cidx]]))+ - theme( - axis.text=element_text(size=16), - axis.title=element_text(size=18), - plot.title = element_text(size=22,face="bold") - # axis.text.x = element_text(angle = 0, hjust = 1) - ) + groove_plot(CCDataL, GroovesL) + + ggtitle(sprintf("Land %s groove location",bsldata$land1[odridx[cidx]])) }) output[[paste0("GroovePlotR",idx)]] = renderPlot({ - CCDataR %>% - ggplot(aes(x = x, y = value)) + - geom_line() + - theme_bw()+ - geom_vline(xintercept = 0, colour = "blue") + - geom_vline(xintercept = GroovesR[2]-GroovesR[1], colour = "blue") + - scale_x_continuous(breaks=c(0,round(as.numeric(GroovesR[2]-GroovesR[1]),0),round(seq(min(CCDataR$x),max(CCDataR$x),by=500),-2))) + - xlab("Position along width of Land [µm]") + - ylab("Surface Height [µm]") + - ggtitle(paste0("Location of the grooves in Land : ",bsldata$land2[odridx[cidx]]))+ - theme( - axis.text=element_text(size=16), - axis.title=element_text(size=18), - plot.title = element_text(size=22,face="bold") - #axis.text.x = element_text(angle = 90, hjust = 1) - ) + groove_plot(CCDataR, GroovesR) + + ggtitle(sprintf("Land %s groove location",bsldata$land2[odridx[cidx]])) + }) }) temp_groove <- fluidRow(