trackViewer assigning track colors
1
0
Entering edit mode
@tomasrodriguez-21656
Last seen 21 months ago
United States

I am having trouble assigning colors as lists to multiple tracks. As far as I can tell, my approach is identical to that of the ?setTrackStyleParam example for designating track colors. I am not the best at dealing with this list type, so any help would be appreciated.

> setTrackStyleParam(trackList,"color",value = c("red4","blue1","blue2","blue3","purple"))
#Error in (function (classes, fdef, mtable)  : 

  unable to find an inherited method for function 'setTrackStyleParam' for signature '"trackList", "character"'
> length(trackList)
#[1] 5

>setTrackStyleParam(trackList[[1]],"color",value = "red4")
#assigning colors to individual elements works fine
trackViewer track • 883 views
ADD COMMENT
2
Entering edit mode
@james-w-macdonald-5106
Last seen 1 hour ago
United States

The first argument for setTrackStyleParam is a track object, not a trackList, which is why you get that error. Here is the code from the vignette:

setTrackStyleParam(trackList[[1]], "color", c("green", "black"))
setTrackStyleParam(trackList[[2]], "color", c("black", "blue"))
for(i in 3:length(trackList)) 
    setTrackStyleParam(trackList[[i]], "color", "black")
viewTracks(trackList, gr=gr, viewerStyle=viewerStyle)

You can set it individually, or loop through the tracklist

ADD COMMENT
0
Entering edit mode

Thanks for the tip! I am guessing that the 2-color vectors are for positive and negative values? I mistook these as tracklist elements.

ADD REPLY
1
Entering edit mode

Yes, the two colors are for dat and dat2. dat2 will be plotted as negative values.

ADD REPLY

Login before adding your answer.

Traffic: 737 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6