当前位置:网站首页>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
边栏推荐
- 五层网络协议
- Haas506 2.0 development tutorial - Alibaba cloud OTA - PAC firmware upgrade (only supports versions above 2.2)
- Ethereum ETH的奖励机制
- The primary key is set after the table is created, but auto increment is not set
- 张丽俊:穿透不确定性要靠四个“不变”
- Parker driver maintenance COMPAX controller maintenance cpx0200h
- 張麗俊:穿透不確定性要靠四個“不變”
- Teach yourself to train pytorch model to Caffe (III)
- 使用Aspect制作全局异常处理类
- 【案例】定位的运用-淘宝轮播图
猜你喜欢
Parker驱动器维修COMPAX控制器维修CPX0200H
Display DIN 4102-1 Class B1 fire test requirements
Golang (1) | from environmental preparation to quick start
Longest swing sequence [greedy practice]
The transformation based on vertx web sstore redis to realize the distributed session of vertx HTTP application
使用Aspect制作全局异常处理类
EN 438-7建筑覆盖物装饰用层压板材产品—CE认证
uni-app 蓝牙通信
Clickhouse copy paste multi line SQL statement error
阿里云有奖体验:用PolarDB-X搭建一个高可用系统
随机推荐
selenium 查找b或p标签的内容
Aitm2-0002 12s or 60s vertical combustion test
PostGIS installation geographic information extension
有些事情让感情无处安放
Binary search
【案例】定位的运用-淘宝轮播图
【日常训练--腾讯精选50】89. 格雷编码(看题解才会的)
selenium 获取dom内验证码图片
Generics of TS
Opérations de lecture et d'écriture pour easyexcel
The reason why the ncnn converted model on raspberry pie 4B always crashes when called
Selenium finds the contents of B or P Tags
Interviewer: will concurrent programming practice meet? (detailed explanation of thread control operation)
leetcode:1755. Sum of subsequences closest to the target value
GCC9.5离线安装
PVC 塑料片BS 476-6 火焰传播性能测定
LeetCode_哈希表_困难_149. 直线上最多的点数
Parker driver maintenance COMPAX controller maintenance cpx0200h
How to send samples when applying for BS 476-7 display? Is it the same as the display??
【案例】元素的显示与隐藏的运用--元素遮罩