【问题标题】:Non italic greek letter in axis label without serif (MacOS)没有衬线的轴标签中的非斜体希腊字母(MacOS)
【发布时间】:2019-05-09 03:08:09
【问题描述】:

是否有一个选项可以在R 的轴标签中使用ggplotsans-serif 获得一个漂亮的非斜体希腊字母(在我的情况下为“mu”)?

这是我走了多远:

输出的缩放:

左“mu”:如果我仔细看它不合适:

  • 错误的font(我可以处理)
  • font 大小错误

右“亩”:

  • 完美,但我需要它不是italic,因为它应该是一个单位

(提示:在 R-Studio 预览窗口中显示的不是italic,但我需要正确的 PDF。)

这里是R-code:

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 

【问题讨论】:

  • 它在我用你的代码得到的pdf中以“非斜体”字符显示...
  • 您能否将sessionInfo() 的输出添加到您的帖子中,可能是操作系统特定的字体问题?
  • 在我的 windows 机器上它也不是italic
  • 我在上面的代码中添加了sessionInfo()

标签: r macos ggplot2 fonts typography


【解决方案1】:

我使用的是 Mac OS 并且遇到了同样的问题。我通过将图像保存为 .eps 文件来解决它。在预览中打开 .eps 仍显示单位为斜体,但在另一个图像编辑器中打开时,单位为非斜体。

【讨论】:

  • 好提示。可悲的是,我需要将其导入 LaTeX 并且无法更改它。
猜你喜欢
  • 1970-01-01
  • 2014-11-02
  • 2014-02-01
  • 1970-01-01
  • 2020-03-07
  • 2018-07-05
  • 2017-07-22
  • 2012-10-15
  • 2012-07-21
相关资源
最近更新 更多