Gviz: reducing whitespace around tracks
1
0
Entering edit mode
jdbowes • 0
@jdbowes-11176
Last seen 7.7 years ago

Dear all,

Firstly, thank you to the Gviz team for releasing a great visualisation tool.

My problem is that I wish to reduce the whitespace around tracks. For example, in the attached plot I use chromHmm data from roadmap epigenomics for four cell types and these four tracks are separated by a buffer of whitespace. I was wondering if there was an option to reduce this space so the four tracks would be abutted.

Thanks in advance for any suggestions.

John

 

 

 

gviz • 1.9k views
ADD COMMENT
0
Entering edit mode
@florianhahnenovartiscom-3784
Last seen 5.6 years ago
Switzerland

Hi John,

you may want to take a look at the stackHeight display parameter:

'stackHeight=0.75': Numeric between 0 and 1. Controls the vertical size

              and spacing between stacked elements. The number defines

              the proportion of the total available space for the stack

              that is used to draw the glyphs. E.g., a value of 0.5

              means that half of the available vertical drawing space

              (for each stacking line) is used for the glyphs, and thus

              one quarter of the available space each is used for

              spacing above and below the glyph. Defaults to 0.75.

 

Florian

ADD COMMENT
0
Entering edit mode

Hi Florian,

Thanks for taking the time to reply to my post. Adding this parameter didn't seem to make any difference, could this be because the cell data tracks are four separate annotation tracks? Do all the stacked elements need to be in the same track for this parameter to influence the plot?

Best wishes,

John.

ADD REPLY
0
Entering edit mode

Hm, do these annotation tracks contain strand information? I guess what is happening is that Gviz tries to plot them using the standard "arrow" shape, but because there is not enough space for arrow heads they are omitted. Try setting type="box" in addition to stackHeight=1 That should effectively remove all white space between the tracks.

Florian

ADD REPLY
0
Entering edit mode

Hi Florian,

Thanks again for your time. But unfortunately this didn't apear to work. The code I am using to generate the annotation tracks is:

y <- AnnotationTrack(epi, name = track_name)
displayPars(y) = list(rotation.title = 360, cex.title=0.5, stacking="dense", type="box",stackHeight=1, background.title="transparent", col.title="black", col=NULL)

Where the epi object is:

chromosome  start    end       id       feature
chr1        0        9800     15_Quies  255,255,255
chr1        9800     10600    9_Het     138,145,208
chr1        10600    713200   15_Quies  255,255,255
chr1        713200   713400   7_Enh     255,255,0

Thanks

John

 

ADD REPLY
1
Entering edit mode

Sorry, my bad. The parameter is called 'shape', not 'type'.

y <- AnnotationTrack(epi, name = track_name)
displayPars(y) = list(rotation.title = 360, cex.title=0.5, stacking="dense", shape="box",stackHeight=1, background.title="transparent", col.title="black", col=NULL)

That will do the trick.

ADD REPLY
0
Entering edit mode

Perfect, thanks for all your help Florian.

Best wishes

John

ADD REPLY
0
Entering edit mode

I have the same problem, I have several different Annotation Tracks and I want less whitespace between these tracks. I have tried tried using shape ="box" in the displayPars of each anotationTrack.

aTrack.patient3 <- AnnotationTrack(start = patient3_start, 
                               width = patient3_trip,
                               chromosome = "chr1",
                               genome = "hg38", name = "Patient 3",
                               fill = "steelblue4",
                               just.group = "left")
displayPars(aTrack.patient3) = list(stacking="squish", shape="box",stackHeight=0.8,fontsize=24, col=NULL, showId = FALSE)
ADD REPLY

Login before adding your answer.

Traffic: 844 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