当前位置:网站首页>2.2.5 basic sentences of R language drawing
2.2.5 basic sentences of R language drawing
2022-07-05 21:29:00 【A primary school student on the statistics Road】
PART1 About the drawing of pie chart
function :pie()
The basic syntax is :pie(x, labels = names(x),col =(),main = NULL )
among x Is a data vector ,labels = names(x) Label the area of each sector ,col =() Used to set the color of each sector ,main = NULL Used to set the title of the pie chart , If the title is in Chinese, it needs to be suffixed family='GB1'
for instance :
# Data preparation
info = c(1, 2, 4, 8)
# name
names = c("Google", "Runoob", "Taobao", "Weibo")
# Coloring ( Optional )
cols = c("#ED1C24","#22B14C","#FFC90E","#3f48CC")
# Calculate percentage
piepercent = paste(round(100*info/sum(info)), "%")
# mapping
pie(info, labels=piepercent, main = " Website analysis ", col=cols, family='GB1')
# Add color sample annotation
legend("topright", names, cex=0.8, fill=cols)
The final output is :
When we want to draw a three-dimensional pie chart, we need to use pie3D() function , At this time, you need to input the instruction first :install.packages("plotrix", repos = "https://mirrors.ustc.edu.cn/CRAN/") Install drawing expansion pack
边栏推荐
- Is Kai Niu 2980 useful? Is it safe to open an account
- Recursive query of multi-level menu data
- @Validated基础参数校验、分组参数验证和嵌套参数验证
- Utils/index TS tool function
- "Grain mall" -- Summary and induction
- 100 cases of shell programming
- WPF gets the control in the datagridtemplatecolumn of the specified row and column in the DataGrid
- 显示屏DIN 4102-1 Class B1防火测试要求
- R language [data management]
- What are the requirements of UL 2043 test for drive housing in the United States?
猜你喜欢

2022-07-03-CKA-粉丝反馈最新情况

Feng Tang's "spring breeze is not as good as you" digital collection, logged into xirang on July 8!

xlrd常见操作

Alibaba cloud award winning experience: build a highly available system with polardb-x

Why can't Chinese software companies produce products? Abandon the Internet after 00; Open source high-performance API gateway component of station B | weekly email exclusive to VIP members of Menon w

The transformation based on vertx web sstore redis to realize the distributed session of vertx HTTP application

R语言【数据管理】

力扣------经营摩天轮的最大利润

让开发效率飞速提升的跨端方案

基于 Ingress Controller 在集群外访问 Zadig 自测环境(最佳实践)
随机推荐
Aitm 2-0003 horizontal combustion test
EN 438-7 laminated sheet products for building covering decoration - CE certification
vant 源码解析 event.ts 事件处理 全局函数 addEventListener详解
【案例】定位的运用-淘宝轮播图
Some things make feelings nowhere to put
Modifiers of attributes of TS public, private, protect
Utils/index TS tool function
基于 Ingress Controller 在集群外访问 Zadig 自测环境(最佳实践)
MySQL 千万数据量深分页优化, 拒绝线上故障!
思特奇加入openGauss开源社区,共同推动数据库产业生态发展
Teach yourself to train pytorch model to Caffe (2)
Two ways to realize video recording based on avfoundation
张丽俊:穿透不确定性要靠四个“不变”
Teach yourself to train pytorch model to Caffe (I)
Uni app Bluetooth communication
Chapter 05_ Storage engine
SQL common syntax records
selenium 获取dom内属性值的方法
EasyExcel的读写操作
Selenium finds the contents of B or P Tags