PhanstielLab / plotgardener

https://phanstiellab.github.io/plotgardener/
Other
302 stars 28 forks source link

annoYaxis sizing Correct for one plot but incorrect for other 3 plots #108

Closed dlabuz closed 8 months ago

dlabuz commented 8 months ago

Thank you for the great package.

I am trying to put y-axis scaling on my whole genome bisulfite sequencing data (0 to 100 methylation).

I have come across the annoYaxis function has the correct size for the bottom plot (height = 0.6) but the y-axis annotation is much bigger for the top 3 plots. Is there a way to fix this? Using a pgParams setting of 0.6 height did not change the y axis size.

Here is my code to generate the plots:

MAIT_HD1_Plot <-plotSignal(
    data = HD1_MAIT,
    chrom = "chr11", chromstart = 114061000, chromend = 114064400,
    assembly = "hg38",linecolor = brewer.pal(n =9, "Greys")[9],
    x = 8.5, y = 2.3, width = 6.5, height = 0.6,
    just = c("right", "top"), default.units = "inches"
)

MAIT_HD2_Plot <-plotSignal(
    data = HD2_MAIT,
    chrom = "chr11", chromstart = 114061000, chromend = 114064400,
    assembly = "hg38",linecolor = brewer.pal(n =9, "Greys")[9],
    x = 8.5, y = 3.05, width = 6.5, height = 0.6,
    just = c("right", "top"), default.units = "inches"
)

MAIT_AS1_Plot <-plotSignal(
    data = AS1_MAIT,
    chrom = "chr11", chromstart = 114061000, chromend = 114064400,
    assembly = "hg38",linecolor = brewer.pal(n =9, "Set1")[1],
    x = 8.5, y = 3.80, width = 6.5, height = 0.6,
    just = c("right", "top"), default.units = "inches"
)

MAIT_AS2_Plot <-plotSignal(
    data = AS2_MAIT,
    chrom = "chr11", chromstart = 114061000, chromend = 114064400,
    assembly = "hg38",linecolor = brewer.pal(n =9, "Set1")[1],
    x = 8.5, y = 4.55, width = 6.5, height = 0.6,
    just = c("right", "top"), default.units = "inches"
)

annoYaxis(plot = MAIT_HD1_Plot, at = c(0, 100), main = FALSE, axisLine = FALSE)
annoYaxis(plot = MAIT_HD2_Plot, at = c(0, 100), main = FALSE, axisLine = FALSE)
annoYaxis(plot = MAIT_AS1_Plot, at = c(0, 100), main = FALSE, axisLine = FALSE)
annoYaxis(plot = MAIT_AS2_Plot, at = c(0, 100), main = FALSE, axisLine = FALSE)

Thank you!

annoYaxis_sizing

dlabuz commented 8 months ago

I found the reason, the other plots only had maxscores of 70-80% methylation.

nekramer commented 8 months ago

I'm glad your issue was resolved! The y-axis annotation should always match the height of the plot, even if you can't see the full range of the data. Since this can be tricky to see, I recommend setting axisLine = TRUE for debugging.

Nicole