• 条形图 > 玫瑰图 > 饼图 > 环状图


    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)
    

  • 相关阅读:
    VBA.replace替换单引号或双引号
    读取文件
    UPDATE
    alter update
    SQL日期格式
    python map的用法
    python os模块用法
    python re.I compile search
    python 正则匹配
    通过list中值得名称查询索引号
  • 原文地址:https://www.cnblogs.com/mmtinfo/p/15839936.html
Copyright © 2020-2023  润新知