Closed g-zavagno closed 10 months ago
Hi @g-zavagno
The error you are seeing is because the function expects a single color, since it plots a single bigwig area plot. The idea is that you use multiple calls to kpPlotBigWig, one for each mark, and specify the color in each call.
If this is not what you are doing or it does not work for you, could you please send a minimal complete example with a minimal data file?
Hope this helps!
Bernat
Hi, thanks for your quick reply. I've been using autotracks to plot 4 histone tracks in one data panel - so does this mean that when using autotracks, there's no option for changing the colour of each histone track? An example would actually be your tutorial on ENCODE Epigenetic plotting. I'm following the tutorial to the letter. As a solution to my problem, I could plot the four tracks without autotracks and configure the r0 and r1 to align them if I wanted them individually coloured.
Ok, now I see the problem.
Yes, you can combine autotracks with different colors. For that, you can use the same strategy as for the track labels. In the for loop you define i
as the current histone mark number. With that you select the histone mark name with names(histone.marks)[i]
.
So the best approach would be to define a color vector before the start of the loop
histone.mark.colors <- c("red", "green", "blue", "orchid")
and then, in the call to kpPlotBigWig
select the color you want for that track:
col=histone.mark.colors[i]
Does it make sense?
Bernat
Thanks for your quick reply! Yes, it's worked perfectly. Seems so obvious in retrospect. Thanks again for your time!
Best,
Giulia
No problem!
Happy to help
Hi, I've really enjoyed working with KaryoploteR and the tutorials have been fantastic. I was wondering whether it was possible to color each histone track individually? Such as H3K4me1 enhancers as yellow, and H3K4me3 promoters as red? I've tried making a vector:
kp <- kpPlotBigWig(kp, data=bigwig.file, ymax="visible.region", r0=at$r0, r1=at$r1, col = c("lightblue3", "green", "grey", "blue"), data.panel=2)
but get this error:
Thank you!