Closed fanghu-hku closed 1 year ago
Hi,
I've not seen this problem before. Could you upload a screenshot? Have you come across this problem on other plots?
Kevin
Hi Kevin, The screenshot is attached. I didn't come across this problem before. Actually I used sigfit about one year ago and it works well. Not sure if there is something wrong with the UTF-8 encoding or something?
Hu
Hi Hu,
These spectrum plots are made using the standard barplot
function. The only unusual things we do are:
family="mono"
to render the x-axis textcairo_pdf
instead of pdf
to write the output fileMaybe you could check if the text renders correctly with a generic barplot
call, e.g.
cairo_pdf("test_cairo.pdf")
set.seed(1)
data <- runif(10, 1, 5)
lab <- letters[1:10]
barplot(data, names.arg = lab, las = 2, ylim = c(0, 5), yaxt = "n", family = "mono")
axis(side = 2, at = seq(0, 5))
title(main = "Test")
dev.off()
and see if the text comes out properly.
Kevin
Hi Kevin, Thanks for your reply. This doen't work properly (see Test1).
cairo_pdf("test_cairo.pdf")
set.seed(1)
data <- runif(10, 1, 5)
lab <- letters[1:10]
barplot(data, names.arg = lab, las = 2, ylim = c(0, 5), yaxt = "n", family = "mono")
axis(side = 2, at = seq(0, 5))
title(main = "Test")
dev.off()
But when I remove " family = "mono"" (Test2) or replace "cairo_pdf" with "pdf" (Test2), it seems work well. TEST1.pdf TEST2.pdf TEST3.pdf
Hi,
This looks like it's an issue with how either Cairo or monospaced fonts are set up on your system. However, I've pushed a possible workaround for you to a new "pdf" branch. If you want to try it out, you could reinstall sigfit using
remotes::install_github("kgori/sigfit@pdf",
build_vignettes=TRUE,
build_opts = c("--no-resave-data", "--no-manual"))
Then, when plotting, use the use_cairo
argument to select the graphics device:
plot_spectrum(mutations, name = "Plotted with Cairo device", pdf_path = "cairoplot.pdf", use_cairo = TRUE)
plot_spectrum(mutations, name = "Plotted with standard device", pdf_path = "standardplot.pdf", use_cairo = FALSE)
Hopefully the standard device with be able to render your text properly.
Hi, Thank you for developing sigfit and it is an amazing tool. When I am trying to run the example code from Vignette:
The output of the spectrum looks weird as the Trinucleotide context names below bars are unicode instead of letters. Do you have any ideas of what happened?
sessionInfo() R version 4.0.3 (2020-10-10) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.1 LTS
Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C