library(chromatoplotsgui)
library(chromatoplots)
setwd("/Users/marie/Documents/repos/chromatoplotsgui/data/raw/treatment_0")
raw1 <- loadSample(dir())
prof <- genProfile(raw1)
cor <- removeBaseline(prof, 'median', scanrad = 100)
# peaks <- findPeaks(cor, 'gauss')
# save(peaks, file = 'peaks.rda')
load("/Users/marie/Documents/repos/chromatoplotsgui/data/peaks.rda")
cgfindPeaksPlot(peaks, cor, 201)
## customization
require(cranvas)
require(qtpaint)
qiris <- qdata(iris, color = Species)
myplot <- qscatter(data = qiris, x = Sepal.Length,
y = Sepal.Width )
# myplot
anotherplot <- qscatter(data = qiris, x = Petal.Length,
y = Petal.Width)
anotherplot$view$setGeometry(Qt$QRect(25, 400, 350, 350))
threshold <- 5.5
## define new handlers
newpaint <- function(layer, painter){
## add a line indicating some threshold
qdrawLine(painter, x = c(threshold, threshold),
y = myplot$meta$limits[,2],
stroke = "red")
}
newhover <- function(layer, event){
## show anotherplot if the mouse exceeds the threshold
## hide if below threshold
if(event$pos()$x() > threshold){
anotherplot$view$show()
} else {
anotherplot$view$hide()
}
}
newkeyPress <- function(layer, event){
print("ok")
event$ignore()
}
## create the layer
newlayer <- qlayer(paintFun = newpaint,
hoverMoveFun = newhover,
keyPressFun = newkeyPress,
limits = qrect(myplot$meta$limits))
## add/sync layer to cranvas plot
myplot$layerList[[1]][1,2] <- newlayer
sync_limits(myplot$meta, newlayer)
## push the plot
myplot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.