Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

R language output pdf picture appears Chinese garbled what to do

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Today, I would like to share with you the R language output of pdf pictures in Chinese garbled how to do the relevant knowledge, detailed content, clear logic, I believe that most people still know too much about this knowledge, so share this article for your reference, I hope you have something to gain after reading this article, let's take a look at it.

Solution:

1. Use the basic package and add: family= "GB1" option when using the function pdf () output

When using the pdf () function, there is only one font available to output Chinese. Example:

Pdf ("chinese.pdf", family= "GB1") plot (m ~ 2) XLAB = "height", ylab= "weight", main= "Statistics") dev.off ()

Here the font parameter family can only be set to "GB1" (I wonder if there are other fonts to choose from), and the default is Arial.

2. Use Cairo package and use CairoPDF () function to output

When using the Cairo package, you can choose a variety of fonts for Chinese output. However, this package must be downloaded and installed first.

Example:

CairoPDF ("chinese.pdf", family= "SimSun") plot ("chinese.pdf", family= "SimSun") plot (1jie 10, "Verdana", family= "SimSun"); text (2Mei8, "boldface", family= "SimHei"); text (2Jie 6, "italic", family= "KaiTi_GB2312"); text (2Jie 4, "official script", family= "LiSu"); text (2Jing 2, "Young Circle", family= "YouYuan"); text (6PM10, "Arial", family= "Arial") Text (6Consolas 8, "Times New Roman", family= "Times New Roman"); text (6Consolas 6, "Courier New", family= "Courier New"); text (6 Consolas 4, "Consolas", family= "Consolas"); text (6 Symbol, family= "Symbol"); dev.off ()

The family parameter is the font name, such as Arial: SimSun, bold: SimHei.

Attached Font-name Mapping Table:

New fine body, PMingLiU

Fine body, MingLiU

Canonical, DFKai-SB

Boldface, SimHei

Song style, SimSun

New Song style, NSimSun

Imitating Song Dynasty, FangSong

Arial, KaiTi

Imitating Song _ GB2312, FangSong_GB2312

Italics _ GB2312, KaiTi_GB2312

Microsoft is boldface, Microsoft JhengHei

Microsoft Yahei, Microsoft YaHei

Official script, LiSu

Young circle, YouYuan

Chinese Fine Black, STXihei

Chinese italics, STKaiti

Chinese Arial, STSong

Song, STZhongsong, in Chinese

Chinese imitation of Song, STFangsong

Founder Shu body, FZShuTi

Founder Yao body, FZYaoti

Chinese Caiyun, STCaiyun

Chinese Amber, STHupo

Chinese official script, STLiti

Chinese Xingkai, STXingkai

Chinese New Wei, STXinwei

These are all the contents of the article "what to do with Chinese garbled in R language output pdf pictures". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report