条形图 -> 玫瑰图 -> 饼图 -> 环状图
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | library (ggplot2) library (cowplot) df<- data.frame (K= LETTERS [1:4],V= c (10,20,100,60)) p1<- ggplot (df, aes (x=K,y=V,fill=K))+ geom_bar (stat = 'identity' )+ labs (title= "P1" ) p2<- ggplot (df, aes (x=K,y=V,fill=K))+ geom_bar (stat = 'identity' )+ coord_polar ()+ labs (title= "P2" ) p3<- ggplot (df, aes (x=K,y=V,fill=K))+ geom_bar (stat = 'identity' )+ coord_polar (theta = "y" )+ labs (title= "P3" ) p4<- ggplot (df, aes (x= "" ,y=V,fill=K))+ geom_bar (stat = 'identity' )+ coord_polar (theta = "y" )+ labs (title= "P4" ) p5<- ggplot (df, aes (x= "" ,y=V,fill=K))+ geom_bar (stat = 'identity' )+ coord_polar ()+ labs (title= "P5" ) p6<- ggplot (df, aes (x= "" ,y=V,fill=K))+ geom_bar (stat = 'identity' )+ coord_polar (theta = "y" )+ geom_rect ( aes (xmin=0,ymin=0,xmax=0,ymax=0))+ labs (title= "P6" ) cowplot:: plot_grid (p1,p2,p3,p4,p5,p6) |
作者:天使不设防
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!