ggpie 包绘制饼图
library(ggpie)
library(ggplot2)
data(diamonds)
# 1 -----------------------------------------------------------------------
ggpie(data = diamonds, group_key = "cut", count_type = "full",label_type = "none")
# 2 -----------------------------------------------------------------------
ggpie(data = diamonds, group_key = "cut", count_type = "full",
label_info = "all", label_type = "circle",
label_size = 4, label_pos = "out")
# 3 -----------------------------------------------------------------------
ggpie(data = diamonds, group_key = "cut", count_type = "full",
label_info = "all", label_type = "circle", label_split = NULL,
label_size = 4, label_pos = "in")
# 4 -----------------------------------------------------------------------
ggpie(data = diamonds, group_key = "cut", count_type = "full",
label_info = "all", label_type = "horizon", label_split = NULL,
label_size = 4, label_pos = "in")
# 5 -----------------------------------------------------------------------
ggpie(data = diamonds, group_key = "cut", count_type = "full",
label_info = "all", label_type = "horizon",
label_size = 4, label_pos = "in")
# 6 -----------------------------------------------------------------------
ggpie(data = diamonds, group_key = "cut", count_type = "full",
label_info = "all", label_type = "horizon",
label_size = 4, label_pos = "out" )
# 7 -----------------------------------------------------------------------
ggpie(data = diamonds, group_key = "cut", count_type = "full",
label_info = "all", label_type = "horizon", label_split = NULL,
label_size = 4, label_pos = "in", labal_threshold = 10)
# 8 -----------------------------------------------------------------------
ggdonut(data = diamonds, group_key = "cut", count_type = "full",
label_type = "none")
# 9 -----------------------------------------------------------------------
ggdonut(data = diamonds, group_key = "cut", count_type = "full",
label_info = "all", label_type = "circle",
label_size = 4, label_pos = "out")
# 10 ----------------------------------------------------------------------
ggdonut(data = diamonds, group_key = "cut", count_type = "full",
label_info = "all", label_type = "circle", label_split = NULL,
label_size = 4, label_pos = "in")
# 11 ----------------------------------------------------------------------
ggdonut(data = diamonds, group_key = "cut", count_type = "full",
label_info = "all", label_type = "horizon", label_split = NULL,
label_size = 4, label_pos = "in")
# 12 ----------------------------------------------------------------------
ggdonut(data = diamonds, group_key = "cut", count_type = "full",
label_info = "all", label_type = "horizon",
label_size = 4, label_pos = "in")
# 13 ----------------------------------------------------------------------
ggdonut(data = diamonds, group_key = "cut", count_type = "full",
label_info = "all", label_type = "horizon", label_split = NULL,
label_size = 4, label_pos = "out")
# 14 ----------------------------------------------------------------------
ggdonut(data = diamonds, group_key = "cut", count_type = "full",
label_info = "all", label_type = "horizon",
label_size = 4, label_pos = "out")
# 15 ----------------------------------------------------------------------
ggdonut(data = diamonds, group_key = "cut", count_type = "full",
label_info = "all", label_type = "horizon",
label_size = 4, label_pos = "in", labal_threshold = 10)
# 16 ----------------------------------------------------------------------
p1= ggpie3D(data = diamonds, group_key = "cut", count_type = "full", tilt_degrees = -10, label_size=2) +
ggtitle("tilt_degrees = -10") +
theme(plot.title = element_text(hjust = 0.5))
p2= ggpie3D(data = diamonds, group_key = "cut", count_type = "full", tilt_degrees = -40, label_size=2) +
ggtitle("tilt_degrees = -40") +
theme(plot.title = element_text(hjust = 0.5))
p3= ggpie3D(data = diamonds, group_key = "cut", count_type = "full", tilt_degrees = -10,
start_degrees = 60, label_size=2) +
ggtitle("start_degrees = 60") +
theme(plot.title = element_text(hjust = 0.5))
p4= ggpie3D(data = diamonds, group_key = "cut", count_type = "full", tilt_degrees = -10,
start_degrees = 180, label_size=2) +
ggtitle("start_degrees = 180") +
theme(plot.title = element_text(hjust = 0.5))
cowplot::plot_grid(p1,p2,p3,p4,ncol = 2)
# 17 ----------------------------------------------------------------------
ggnestedpie(data = diamonds, group_key = c("cut", "color"), count_type = "full",
inner_label_info = "all", inner_label_split = NULL,inner_label_size = 2,
outer_label_type = "circle", outer_label_pos = "in", outer_label_info = "all")
# 18 ----------------------------------------------------------------------
ggnestedpie(data = diamonds, group_key = c("cut", "color"), count_type = "full",
inner_label_info = "all", inner_label_split = NULL,
inner_labal_threshold = 5, inner_label_size = 2,
outer_label_type = "circle", outer_label_pos = "in", outer_label_info = "all")
# 19 ----------------------------------------------------------------------
ggnestedpie(data = diamonds, group_key = c("cut", "color"), count_type = "full",
inner_label_info = "all", inner_label_split = NULL, inner_label_size = 2,
outer_label_type = "circle", outer_label_pos = "out", outer_label_info = "all")
# 20 ----------------------------------------------------------------------
ggnestedpie(data = diamonds, group_key = c("cut", "color"), count_type = "full",
inner_label_info = "all", inner_label_split = NULL,
inner_labal_threshold = 1, inner_label_size = 2,
outer_label_type = "horizon", outer_label_pos = "out", outer_label_info = "all")
# 21 ----------------------------------------------------------------------
ggnestedpie(data = diamonds, group_key = c("cut", "color"), count_type = "full",
inner_label_info = "all", inner_label_split = NULL,
inner_labal_threshold = 1, inner_label_size = 2,
outer_label_type = "horizon", outer_label_pos = "in",
outer_label_info = "all", outer_labal_threshold = 10)
# 22 ----------------------------------------------------------------------
ggnestedpie(data = diamonds, group_key = c("cut", "color"), count_type = "full",
r0 = 0.5, r1 = 1.5, r2 = 2.6,inner_label_info = "all", inner_label_split = NULL,
inner_labal_threshold = 1, inner_label_size = 2,
outer_label_type = "horizon", outer_label_pos = "in",
outer_label_info = "all", outer_labal_threshold = 10)
# 23 ----------------------------------------------------------------------
# pie plot
p1=ggrosepie(diamonds, group_key = "color", count_type = "full", label_info = "all",
show_tick=F,donut_frac=NULL)
# donut plot
p2=ggrosepie(diamonds, group_key = "color", count_type = "full", label_info = "all",
show_tick=F,donut_frac=0.3,donut_label_size=3)
cowplot::plot_grid(p1,p2)
# 24 ----------------------------------------------------------------------
# pie plot
p1=ggrosepie(diamonds, group_key = "color", count_type = "full", label_info = "all",
donut_frac=NULL)
# donut plot
p2=ggrosepie(diamonds, group_key = "color", count_type = "full", label_info = "all",
donut_frac=0.3,donut_label_size=3)
cowplot::plot_grid(p1,p2)
# 25 ----------------------------------------------------------------------
# pie plot
p1=ggrosepie(diamonds, group_key = "color", count_type = "full", label_info = "all",
tick_break = c(3000,5000,7000,11000), donut_frac=NULL)
# donut plot
p2=ggrosepie(diamonds, group_key = "color", count_type = "full", label_info = "all",
tick_break = c(3000,5000,7000,11000), donut_frac=0.3,donut_label_size=3)
cowplot::plot_grid(p1,p2)
# 26 ----------------------------------------------------------------------
# pie plot
p1=ggrosepie(diamonds, group_key = c("color","clarity"),
count_type = "full", label_info = "all",
show_tick=F,donut_frac=NULL)
# donut plot
p2=ggrosepie(diamonds, group_key = c("color","clarity"),
count_type = "full", label_info = "all",
show_tick=F,donut_frac=0.3,donut_label_size=3)
cowplot::plot_grid(p1,p2)
# 27 ----------------------------------------------------------------------
# pie plot
p1=ggrosepie(diamonds, group_key = c("color","clarity"),
count_type = "full", label_info = "all",
donut_frac=NULL)
# donut plot
p2=ggrosepie(diamonds, group_key = c("color","clarity"),
count_type = "full", label_info = "all",
donut_frac=0.3,donut_label_size=3)
cowplot::plot_grid(p1,p2)
# 28 -----------------------------------------------------------------------
ggpie(data = diamonds, group_key = "cut", count_type = "full",
label_info = "all", label_type = "horizon",
label_size = 4, label_pos = "out" )
# 29 -----------------------------------------------------------------------
ggpie(data = diamonds, group_key = "cut", count_type = "full",
label_info = "all", label_type = "horizon", label_split = NULL,
label_size = 4, label_pos = "in", labal_threshold = 10)
# 30 -----------------------------------------------------------------------
ggpie(data = diamonds, group_key = "cut", count_type = "full",
label_info = "ratio", label_type = "horizon", label_split = NULL,
label_size = 3.5, label_pos = "in", labal_threshold = 10,
label_color = 'black')
# 31 -----------------------------------------------------------------------
ggdonut(data = diamonds, group_key = "cut", count_type = "full",
label_info = "all", label_type = "horizon",
label_size = 4, label_pos = "out")
# 32 ----------------------------------------------------------------------
ggdonut(data = diamonds, group_key = "cut", count_type = "full",
label_info = "ratio", label_type = "horizon",
label_size = 4, label_pos = "out",
donut.label.color = 'black')