r - 如何在 RStudio 中为 ggplot2 安装 Courier 字体
问题描述
更新我的操作系统后,我的 Rstudio 中的字体消失了,特别是我需要 ggolot2的Courier 。
为了解决我安装的问题:
library(extrafont)
接着:
font_import()
现在我有几种字体,但它们大多不受欢迎。例如:
fonts()
"aakar" "Abyssinica SIL" "Ani" "AnjaliOldLipi" "Chilanka" "DejaVu Sans"
"DejaVu Sans Mono" "DejaVu Serif" "Droid Sans Fallback" "Dyuthi"
如何安装我需要的 Courier 字体?
我跑:
- Ubuntu 18.04
- R 版本 3.4.4
- RStudio 版本 1.2.5033
解决方案
只需将样式添加到 .Rmd 文件中的 yaml 定义中,如下所示:
---
title: "R Notebook"
output:
html_document:
css: style.css
---
This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code.
style.css
然后在同一文件夹中创建一个文件并粘贴此代码:
body{
font-family: "Courier New", Courier, monospace;
font-size: 16pt;
}
然后重新编织它,它会工作。
如果 Courier 字体不在您的 Ubuntu 系统中,您可以通过此处安装它
推荐阅读
- database - 从数据库中删除数据并将其保存在我可以视为实体的其他位置
- python - 两个 Pandas 数据帧之间的多个条件总和
- java - org.springframework.boot.builder.SpringApplicationBuilder。
([Ljava/lang/Object;)V - javascript - 在 ngSwitchCase 中使用额外的参数
- configuration - configtx.yaml 中的组织
- android - 在设备注册时未通过 DevicePolicyManager 在 Android Q 中为设备所有者应用授予后台位置权限
- r - 从 GLMM 中提取方差分量
- r - 宽格式:计算特定批次列的行均值的函数,然后按比例放大多个批次
- set - 使用仅包含一种元素的集合的子集计算不同分区的方法
- sql - 如何回滚从存储过程中批量声明的事务?