I have returned a FeaturePlot from Seurat to ggplot by this code.
head(mat[1:4,1:4])
s1.1 s1.2 s1.3 s1.4
DDB_G0267178 0 0.009263254 0 0.01286397
DDB_G0267180 0 0.000000000 0 0.00000000
DDB_G0267182 0 0.000000000 0 0.03810585
DDB_G0267184 0 0.000000000 0 0.00000000
I have converted expression matrix to a binary matrix by 2 as a threshold
mat[mat < 2] <- 0
mat[mat > 2] <- 1
head(exp[1:4,1:4])
s1.1 s1.2 s1.3 s1.4
DDB_G0267382 0 0 0 1
DDB_G0267438 0 0 0 1
DDB_G0267466 0 0 0 0
DDB_G0267476 0 0 1 0
exp=as.matrix(exp)
colnames(exp)="value"
exp=as.data.frame(exp)
cc <- AddMetaData(object = seurat, metadata = exp)
cc <- SetAllIdent(object = cc, id = "value")
TSNEPlot(object = cc, do.return= TRUE)
My plot has a weird range of colours as below
I returned a FeaturePlot from Seurat to ggplot. My plot has a weird range of colours as below
enter image description here
I produced this plot by this code
head(mat[1:4,1:4])
s1.1 s1.2 s1.3 s1.4
DDB_G0267178 0 0.009263254 0 0.01286397
DDB_G0267180 0 0.000000000 0 0.00000000
DDB_G0267182 0 0.000000000 0 0.03810585
DDB_G0267184 0 0.000000000 0 0.00000000
I have converted expression matrix to a binary matrix by 2 as a threshold
mat[mat < 2] <- 0
mat[mat > 2] <- 1
head(exp[1:4,1:4])
s1.1 s1.2 s1.3 s1.4
DDB_G0267382 0 0 0 1
DDB_G0267438 0 0 0 1
DDB_G0267466 0 0 0 0
DDB_G0267476 0 0 1 0
exp=as.matrix(exp)
colnames(exp)="value"
exp=as.data.frame(exp)
cc <- AddMetaData(object = seurat, metadata = exp)
cc <- SetAllIdent(object = cc, id = "value")
TSNEPlot(object = cc, do.return= TRUE)
How I can convert this range to a gradient of colours for example in 8-18, 18-28, 28-38, 38-48 range in blue to yellow please? Something like below