Question: How to change the font size in autoplot and track functions in ggbio
1
gravatar for yogacacarolom
4.6 years ago by
Brazil
yogacacarolom60 wrote:

I am using the tracks function from ggbio package, but I am unable to change the size in the x axis.

The df dataframe:

 

    chr    start     end           id
    chr12 72065147 72204484 ENSBTAG00000045751
    chr12 72529373 72690449 ENSBTAG00000047181
    chr12 73574461 73704802 ENSBTAG00000046041
    chr12 73890111 73977633 ENSBTAG00000047764
    chr12 74198711 74199129 ENSBTAG00000047360
    chr12 74816044 74978179 ENSBTAG00000023309
    chr12 75457896 75536848 ENSBTAG00000026070
    chr12 75664651 75870596 ENSBTAG00000039714
    chr12 76758753 76864805 ENSBTAG00000003568
    chr12 76867833 76922959 ENSBTAG00000003569
    chr12 76958977 77024110 ENSBTAG00000012065
    chr12 77032585 77176916 ENSBTAG00000004401

library(ggbio)
library(GenomicRanges)
gr <- makeGRangesFromDataFrame(df, TRUE)
ex <- autoplot(gr, ylab = "Soft") + theme(text = element_text(size=20))
tracks(ex)

In this example just the y axis in changed by theme (size =20). The x axis continues very small. Interestingly if I don´t use tracks function (just autoplot function) the two axis (x and y) change normally to my desired size (size =20). However, I have several objects to plot in track from my actual data, which  coerce me to use tracks function. Any idea why it is not working?

Thank you very much!

ggbio ggplot bioconductor R • 2.4k views
ADD COMMENTlink modified 4.6 years ago by Istvan Albert ♦♦ 80k • written 4.6 years ago by yogacacarolom60
1

I have never used ggbio package (but I have used ggplot2 extensively) so I may not be 100% correct. I wanted to give this a try myself but I couldn't as I have R version 3.1.1 and apparently this package is not available for this version. Instead, I looked up the manual for ggbio. On page 84-85, you can see there are multiple functions names theme_*. It says these themes are designed for ggbio plots/tracks. One of them is theme_tracks_sunset(). I think you may want to give it a try. 

Crossposted @ StackOverflow

ADD REPLYlink modified 4.6 years ago • written 4.6 years ago by komal.rathi3.4k

I don't think it is possible. You could save image in vector graphics format - SVG - then use image editing software, e.g.: InkSkape, Photoshop...

ADD REPLYlink modified 4.6 years ago • written 4.6 years ago by zx87547.1k

Why it is not possible? This is not a ggplot2 based package? I really do not understand.

ADD REPLYlink modified 4.6 years ago • written 4.6 years ago by yogacacarolom60
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 806 users visited in the last hour