是否可以选择在R
的轴标签中应用ggplot
和sans-serif
来获得一个很好的非斜体希腊字母(在我的情况下为“ mu”)?
左“ mu”:如果我仔细看,它不合适:
font
(我可以解决)font
大小右“ mu”:
italic
,因为它应该是一个单元(提示:在R-Studio预览窗口中显示为非italic
,但我需要PDF正确。)
以下是R
代码:
library("ggplot2")
x <- seq(0,10,1)
y <- seq(0,1,0.1)
Data <- data.frame(x,y)
myPlot <- ggplot (Data, aes(x = x,y = y)) +
geom_point() +
scale_x_continuous(expression(paste("[", mu, "m] and [µm]")))+
theme(text = element_text(size=12, family="sans")) +
theme_minimal(); myPlot
ggsave("Test.pdf", width = 16, height = 8, units ="cm", dpi = 1200)
更新I:sessionInfo()
的输出仅在MacO而不是Windows上显示。
sessionInfo()
> R version 3.5.1 (2018-07-02)
> Platform: x86_64-apple-darwin15.6.0 (64-bit)
> Running under: macOS High Sierra 10.13.6
> Matrix products: default
> BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
> LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
> locale:
> [1] de_DE.UTF-8/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
> other attached packages:
> [1] ggplot2_3.1.0
> loaded via a namespace (and not attached):
> [1] Rcpp_0.12.19 withr_2.1.2 assertthat_0.2.0 crayon_1.3.4 dplyr_0.7.7 R6_2.3.0
> [7] grid_3.5.1 plyr_1.8.4 gtable_0.2.0 magrittr_1.5 scales_1.0.0 pillar_1.3.0
> [13] rlang_0.3.0.1 lazyeval_0.2.1 rstudioapi_0.8 bindrcpp_0.2.2 labeling_0.3 tools_3.5.1
> [19] glue_1.3.0 purrr_0.2.5 munsell_0.5.0 yaml_2.2.0 compiler_3.5.1 pkgconfig_2.0.2
> [25] colorspace_1.3-2 tidyselect_0.2.5 bindr_0.1.1 tibble_1.4.2
答案 0 :(得分:0)
我正在使用Mac OS并遇到相同的问题。我通过将图像另存为.eps文件来解决此问题。在预览中打开.eps仍显示单位为斜体,但是在另一个图像编辑器中打开时,单位非斜体。