当前位置:网站首页>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
边栏推荐
- 力扣------经营摩天轮的最大利润
- Clickhouse copy paste multi line SQL statement error
- Influence of oscilloscope probe on measurement bandwidth
- Two ways to realize video recording based on avfoundation
- Explain various hot issues of Technology (SLB, redis, mysql, Kafka, Clickhouse) in detail from the architecture
- [daily training -- Tencent select 50] 89 Gray code (only after seeing the solution of the problem)
- Clion configures Visual Studio (MSVC) and JOM multi-core compilation
- PostGIS installation geographic information extension
- 木板ISO 5660-1 热量释放速率摸底测试
- Selenium gets the verification code image in DOM
猜你喜欢
Evolution of zhenai microservice underlying framework from open source component encapsulation to self-development
R language [data management]
"Grain mall" -- Summary and induction
Feng Tang's "spring breeze is not as good as you" digital collection, logged into xirang on July 8!
事项研发工作流全面优化|Erda 2.2 版本如“七”而至
EN 438-7建筑覆盖物装饰用层压板材产品—CE认证
Parker driver maintenance COMPAX controller maintenance cpx0200h
MMAP
Pytoch practice -- MNIST dataset handwritten digit recognition
张丽俊:穿透不确定性要靠四个“不变”
随机推荐
EasyExcel的讀寫操作
基于vertx-web-sstore-redis的改造实现vertx http应用的分布式session
MQ----activeMq
POJ 3414 pots (bfs+ clues)
ESP32
sql常用语法记录
有些事情让感情无处安放
递归查询多级菜单数据
WPF gets the control in the datagridtemplatecolumn of the specified row and column in the DataGrid
AITM 2-0003 水平燃烧试验
Deployment of Jenkins under win7
Enclosed please find. Net Maui's latest learning resources
ODPs next map / reduce preparation
ESP32
SQL series (basic) - Chapter 2 limiting and sorting data
【日常训练--腾讯精选50】89. 格雷编码(看题解才会的)
Incentive mechanism of Ethereum eth
力扣------经营摩天轮的最大利润
Cross end solution to improve development efficiency rapidly
The reason why the ncnn converted model on raspberry pie 4B always crashes when called