当前位置:网站首页>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
边栏推荐
- Arcgis\qgis no plug-in loading (no offset) mapbox HD image map
- Pytoch practice -- MNIST dataset handwritten digit recognition
- XML modeling
- 使用Aspect制作全局异常处理类
- Deep merge object deep copy of vant source code parsing
- 【日常训练--腾讯精选50】89. 格雷编码(看题解才会的)
- Determine the best implementation of horizontal and vertical screens
- Alibaba cloud award winning experience: build a highly available system with polardb-x
- How to send samples when applying for BS 476-7 display? Is it the same as the display??
- Modifiers of attributes of TS public, private, protect
猜你喜欢

Display DIN 4102-1 Class B1 fire test requirements

Clion configures Visual Studio (MSVC) and JOM multi-core compilation

R语言【数据管理】

Access Zadig self-test environment outside the cluster based on ingress controller (best practice)

ArcGIS栅格重采样方法介绍

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

EasyExcel的讀寫操作

Xlrd common operations

Five layer network protocol

Talk about my fate with some programming languages
随机推荐
Uni app Bluetooth communication
力扣------经营摩天轮的最大利润
張麗俊:穿透不確定性要靠四個“不變”
EasyExcel的讀寫操作
[daily training -- Tencent select 50] 89 Gray code (only after seeing the solution of the problem)
int GetMonth( ) const throw( ); What does throw () mean?
Aitm 2-0003 horizontal combustion test
AITM2-0002 12s或60s垂直燃烧试验
Selenium's method of getting attribute values in DOM
水泥胶黏剂BS 476-4 不燃性测试
The reason why the ncnn converted model on raspberry pie 4B always crashes when called
第05章_存储引擎
秋招将临 如何准备算法面试、回答算法面试题
字典树简单入门题(居然是蓝题?)
MQ----activeMq
Aitm2-0002 12s or 60s vertical combustion test
【日常训练--腾讯精选50】89. 格雷编码(看题解才会的)
Determine the best implementation of horizontal and vertical screens
Clion configures Visual Studio (MSVC) and JOM multi-core compilation
股票开户选择哪家证券公司比较好哪家平台更安全