当前位置:网站首页>[data analysis and visualization] key points of data drawing 8- use of circular bar chart
[data analysis and visualization] key points of data drawing 8- use of circular bar chart
2022-06-13 02:34:00 【The winter holiday of falling marks】
Key points of data drawing 8- Use of circular bar chart
Circular bar chart RADIAL BAR CHARTS A bar graph drawn in polar coordinates rather than in a Cartesian plane ,RADIAL BAR CHARTS There is no prescribed Chinese translation , Some people translate it as a circular bar chart , Some people translate it as a radial bar graph .
Drawing examples
The following figure shows 2017 Before a certain commodity 6 The number of exports from large countries .
# Import library
library(tidyverse)
library(hrbrthemes)
# Load data
data <- read.table("https://raw.githubusercontent.com/holtzy/data_to_viz/master/Example_dataset/7_OneCatOneNum.csv", header=TRUE, sep=",")
head(data)
nrow(data)
Country | Value | |
---|---|---|
<fct> | <int> | |
1 | United States | 12394 |
2 | Russia | 6148 |
3 | Germany (FRG) | 1653 |
4 | France | 2162 |
5 | United Kingdom | 1214 |
6 | China | 1131 |
51
# Delete null data
data <-filter(data,!is.na(Value))
# Sort data from small to large
data <-arrange(data,Value)
# Extract tail 6 Bit data
data <-tail(data,6)
# Create data tables
data <-mutate(data,Country=factor(Country, Country))
head(data)
nrow(data)
Country | Value | |
---|---|---|
<fct> | <int> | |
33 | United Kingdom | 1214 |
34 | Israel | 1263 |
35 | Germany (FRG) | 1653 |
36 | France | 2162 |
37 | Russia | 6148 |
38 | United States | 12394 |
6
# mapping
ggplot(data, aes(x=Country, y=Value) ) +
geom_bar(fill="#69b3a2", stat="identity") +
geom_text(hjust = 1, size = 3, aes( y = 0, label = paste(Country," "))) +
theme(
panel.grid.minor.y = element_blank(),
panel.grid.major.y = element_blank(),
legend.position="none",
axis.text = element_blank()
) +
xlab("") +
ylab("") +
# Using polar coordinates
coord_polar(theta = "y") +
ylim(0,15000)
The obvious advantage of this graphic is that it is very compelling . however , Because the bar graph is drawn on different radial points of the polar axis , So they have different radii , Cannot compare by length . There are other problems with this diagram , In the absence of Y Axis . The specific reasons are shown in the figure below . In the following figure, if you want to know the relationship of bar values in the first circular bar graph , It is generally judged by the length of the bar . But when the strip is stretched into arc length, it will deform , The comparison result is shown in the second picture , However, the actual results of various bar numerical relationships are the third graph .
resolvent
If you pay attention to the display of data volume , We can add value labels to the circular bar chart or use the bar chart , Lollipop chart .
Add value labels
# mapping
ggplot(data, aes(x=Country, y=Value) ) +
geom_bar(fill="#69b3a2", stat="identity") +
geom_text(hjust = 1, size = 3, aes( y = 0, label = paste(Country," ",Value," "))) +
theme(
panel.grid.minor.y = element_blank(),
panel.grid.major.y = element_blank(),
legend.position="none",
axis.text = element_blank()
) +
xlab("") +
ylab("") +
# Using polar coordinates
coord_polar(theta = "y") +
ylim(0,15000)
Lollipop chart
ggplot(data, aes(x=Country, y=Value) ) +
# Draw line
geom_segment( aes(x=Country ,xend=Country, y=0, yend=Value), color="grey") +
geom_point(size=3, color="#69b3a2") +
# Flip axis
coord_flip() +
theme(
panel.grid.minor.y = element_blank(),
panel.grid.major.y = element_blank(),
legend.position="none"
) +
xlab("")
Reference resources
边栏推荐
- Use of OpenCV 11 kmeans clustering
- Jump model between mirrors
- Introduction to easydl object detection port
- [reading papers] transformer miscellaneous notes, especially miscellaneous
- Paper reading - joint beat and downbeat tracking with recurrent neural networks
- 03 认识第一个view组件
- Mbedtls migration experience
- AutoX. JS invitation code
- [reading papers] deepface: closing the gap to human level performance in face verification. Deep learning starts with the face
- Queuing theory, game theory, analytic hierarchy process
猜你喜欢
Matlab: find the inner angle of n-sided concave polygon
微信云开发粗糙理解
Understand HMM
Flow chart of interrupt process
Classification and summary of system registers in aarch64 architecture of armv8/arnv9
Bai ruikai Electronic sprint Scientific Innovation Board: proposed to raise 360 million Funds, Mr. And Mrs. Wang binhua as the main Shareholder
Mean Value Coordinates
Laravel 权限导出
Paper reading - group normalization
Understand speech denoising
随机推荐
智能安全配电装置如何减少电气火灾事故的发生?
Chapter7-10_ Deep Learning for Question Answering (1/2)
05 tabBar导航栏功能
Principle and steps of principal component analysis (PCA)
0- blog notes guide directory (all)
Find the number of permutations
Chapter7-11_ Deep Learning for Question Answering (2/2)
Solution of depth learning for 3D anisotropic images
CV 06 demonstrates backgroundworker
regular expression
Introduction to arm Cortex-M learning
03 recognize the first view component
1000 fans ~
Think about the possibility of attacking secure memory through mmu/tlb/cache
[pytorch] kaggle large image dataset data analysis + visualization
Deep learning the principle of armv8/armv9 cache
[pytorch] kaggle image classification competition arcface + bounding box code learning
Huffman tree and its application
Armv8-m learning notes - getting started
Classification and summary of system registers in aarch64 architecture of armv8/arnv9