Stata--多维柱状图

作者: 古城路揸fit人 | 来源:发表于2021-04-18 15:00 被阅读0次
    use "$final\\different_reaches_sectorstructure.dta",replace
     
    
    
        rename year Year
    
        ifin 2018 2016 2014 2012,variable(Year)
    
        keep `s(ifin)'
    
        replace PGDP = PGDP/10000
    
        sort Year Reaches
            set scheme tufte //设定图形输出类型
            #delimit ;
            graph bar (asis) PGDP_yellow
              ,  // 后面都是选项设定
              over(Reaches, gap(0) label(nolabel)) //首先按照地区分类, 无横坐标标签
              over(Year,label(labsize(small)))
              asyvars                             //按照地区在y轴分类
              ylabel(, nogrid tposition(inside) labsize(*0.8) angle(0)) 
                  // 纵轴刻度和标签设定
                  // 纵坐标从0-100,刻度线朝内, y轴标签字号为默认字号的 0.8 倍
                  // 标签为纵向放置 (默认是横向)
              ytitle("", tstyle(smbody)) // y 轴标题为小号字体
              blabel(bar, size(small) format(%3.1f))    
                  //产生数字标签,字体小号,固定格式保留1位小数
              bar(1, color("241 128 15%50")) 
              bar(2, color("133 149 127%50"))
              bar(3, color("124 195 195")) 
              legend(row(1) ring(1) position(6) 
                     label(1 `"{fontface "黑体":黄河上游城市}"') 
                     label(2 `"{fontface "黑体":黄河中游城市}"')
                     label(3 `"{fontface "黑体":黄河下游城市}"')                     
                     order(1 2 3) 
                     size(small)) 
              //图例: 呈一列放在图表外6点钟方向,标签按照地区排列,图例字体小号
              graphregion(color(white)) //图片底色为白色
              ;
            #d cr;
    

    相关文章

      网友评论

        本文标题:Stata--多维柱状图

        本文链接:https://www.haomeiwen.com/subject/jccvlltx.html