出城逢虎第五难
Bar plots (条形图)
library(ggpubr)
library(ggplot2)
data("mtcars")
df

image
#按照分组进行排序
p

image
Calculate the z-score of the mpg data:
df$mpg_z

image
Rotate the plot: use rotate = TRUE and sort.val = “desc”
p

image
Dot charts
p1

image
Sort in decending order. sorting = “descending”.
Rotate the plot vertically, using rotate = TRUE.
Sort the mpg value inside each group by using group = “cyl”.
Set dot.size to 6.
Add mpg values as label. label = “mpg” or label = round(df$mpg).
p1

image
p1

image
Cleveland’s dot plot
Color y text by groups. Use y.text.col = TRUE.
p1

image
原文链接:https://www.jianshu.com/p/c0cf31afe1a0
作者:Zee_李海海