I am trying to plot two groups within a single track using Gviz.
sample_tissue = DataTrack(data = all_beta, start = sg_tissue$start, end = sg_tissue$end, chromosome = chr, genome = gen, name = "Tissue Beta", groups = tissue_all_class, degree = .8, family = c("symmetric", "gaussian"), evaluation = 100, background.title = "brown", type = c("smooth", "p"), cex.legend = 0.7, cex.title = .6, cex.axis = .6, ylim = c(0,100))
I would like to change default colours (magenta and cyan), is it possible?
I've read the manual and it describes a step involving the use of feature, and the possibility of overwriting the default fill color, but I can't sort it out.
Moreover, I would like to know if it is possible to set different alphas for different elements in the track. In this case, I would like to have alpha = 1 for the "smooth" and alpha=0.5 for the "p", for example.
Thank you for your help,
Thank you for your answer, I don't know how I managed to miss this very basic attempt
What if there were two DataTracks with data containing the same groups but appearing in a different order (because it is different data) and I want to have the groups to be the same colours? Is there a way to force colours to specific groups?
Using the above example I guess it would be equivalent to:
`dtTrack1 <- DataTrack(range=gr, genome="mm9", name="random data", groups=c(1,1,2,2), col=c("red", "orange"), degree = .8, family = c("symmetric", "gaussian"))
dtTrack2 <- DataTrack(range=gr, genome="mm9", name="random data", groups=c(2,1,1,2), col=c("red", "orange"), degree = .8, family = c("symmetric", "gaussian"))
plotTracks(dtTrack1, dtTrack2, type=c("smooth", "p"))`
And yes - I know that 'col=c("orange", "red")' would solve it with this example but I have many more groups, so this is not what I am after.
Thank you.
Hi Kristian,
You can achieve it with defining group as a
factor
.Best Robert
Thanks. It works when both levels and col are specified, but not if one of them is missing.