This is a test version of Biostars. For the public version, visit https://www.biostars.org.
overlay ggplot graphs like those merging channels in imagej

I wonder if there is a way/package that provides a means to overlay plots (I am thinking of a scatter plot generated by geom_point) in a way similar to overlaying channels in ImageJ.

I would like to check if the two points are overlapped. Visually, a red pixel and green pixel overlay will turn yellow if done in ImageJ. However, the closest I can get to getting a similar result is to set the alpha of the point in geom_point. However, the color is not exactly yellow.

Therefore, I would like to know if there is a way I can produce a similar plot in R.

ggplot imagej

1 answer

Can you show an example of your data? The big difference is that for channel overlay, the underlying datagrid is the same:

x   y   v
1   1   0.1
1   2   0.1
..  ..  ..
1   n   0.0
2   1   0.1
2   2   0.2
..  ..  ..
k   n   0.0

so you could conceviably combine with paste0('#', as.hexmode(255*ch1$v), as.hexmode(255*ch2$v), as.hexmode(255*ch3$v)).

However if you have a bona-fide scatter plot (x and y not aligned) then you'll need to approximate v(x,y) using some kind of interpolation.

Log in to answer this question.