[英]How do I fix the Chinese characters for my saved plot in R?
我试着通过这里的线索寻找答案,但据我所知,没有一个是针对我的问题的。 这是我的查询的一些模拟数据。
#### Load Library ####
library(tidyverse)
#### Set Random Seed ####
set.seed(123)
#### Create Data ####
character <- c("哎","不","嗎","都","發",
"你","肉","吧","地","有")
x <- round(rnorm(n=10,
mean=10))
y <- round(rnorm(n=10,
mean=10))
#### Store Into Tibble ####
tib <- tibble(
character,
x,
y
)
现在,如果我创建这个 plot:
#### Plot ####
tib.plot <- tib %>%
ggplot(aes(x,y,
label=character))+
geom_point()+
geom_label()+
geom_smooth(se=F)+
labs(x="Some Variable",
y="Some Other Variable",
title = "Simulated Plot")+
theme_classic()
tib.plot
在 R 的 plot window 中看起来像这样:
但是,当我尝试使用导出 function 保存 plot 时,由于某些解码/编码问题,它删除了中文字符:
我该如何解决?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.