Support for Linux R in Japanese

Asked 2 years ago, Updated 2 years ago, 42 views

Creating PDF files in Linux R (R language).

pdf(outfile)
plot (expression)
dev.off()

If Japanese is included, it will cause garbled characters.

Do you have a Japanese version of the Linux version in R language or a Japanese patch?

I would appreciate your advice.

linux r

2022-09-30 19:41

3 Answers

Ubuntu 16 (docker image of rocker/tidyverse), but
I could have gone by installing "notosans cjk".

From
#bash (after adding rstudio user to sudoer)
sudo apt install fonts-noto-cjk
at
#R
par(family="Noto Sans")
# Theme() is easy to adjust.
ggplot()
+ theme(axis.text.x=element_text(angle=60, hjust=1))


2022-09-30 19:41

/etc/sysconfig/i18n is the default setting for SentOS 6

LANG="C"
SYSFONT="latarcyrheb-sun16"

where

#LANG="C"
LANG = "ja_JP.UTF-8"
SYSFONT="latarcyrheb-sun16"

Wouldn't it change if I changed it to ?


2022-09-30 19:41

My environment is CentOS 6.5, Rversion 3.1.2

pdf(outfile, family="Japan1")
plot (expression)
dev.off()

How about this?
If you do not specify a font that can be displayed in Japanese, it will cause garbled characters, so set the Japanese font with pdf().

追Additional
RjpWiki Question Corner
Below is a quote from the code we used for verification.

d<-c (0:100)
v1<-10000*exp (-0.05*d)

pdf(file="c:/test.pdf") 

plot(d,v1,xlab="time",ylab="value", 
main=", sub="exponential", pch=22, 
ylim=c(0,10000), type="l", lwd=2)

dev.off()


2022-09-30 19:41

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.