Firstly, loading package and data

Loading Package…

library(dppbar)

Loading Dataset…

To fully illustrate the usage of package to accomplish this task, we use two datasets of different structure. They are “Chinese Real Estate Industry Companies’ Financial Charts(2007-2016)” and “Some Macroeconomic Data of China(2008-2016)”. Head lines of each dataset is shown below.

Chinese Real Estate Industry Companies’ Financial Charts(2007-2016)

##   Year  证券代码 证券简称 season  roa
## 1 2007 000002.SZ    万科A      2 8.18
## 2 2008 000002.SZ    万科A      2 6.66
## 3 2009 000002.SZ    万科A      2 7.37
## 4 2010 000002.SZ    万科A      2 8.86
## 5 2011 000002.SZ    万科A      2 8.09

Some Macroeconomic Data of China(2008-2016)

##   year     ROE   CPI   PPI      GDP
## 1 2008 -0.4826 105.9 106.9 319515.5
## 2 2009  0.2078  99.3  94.6 349081.4
## 3 2010  0.2028 103.3 105.5 413030.3
## 4 2011  0.3533 105.4 106.0 489300.6
## 5 2012  0.2597 102.6  98.3 540367.4

Secondly, done the plot within five lines of R code:

bar_plot(dataframe=estate_fin_charts,ctg.idx = 'Year',num.idx = 'income',
         condition.idx = '证券简称',criteria=2016,top_N=10,
         colors=brewer.pal(12,'Set3'),xaxis_name='年份',yaxis_name='营业收入(亿元)',
         title='2016年营业收入前12名房地产企业历年营收变化',
         paper_bgcolor='#ccece6',margin=list(t=36,l=24))
bar_plot(dataframe=macro_data_chn,ctg.idx='year',num.idx=c(9:12),
         criteria = 2016,colors = brewer.pal(4,'Set1'),
         xaxis_name = '年份',yaxis_name = '商品价格(元/吨)',
         title='一些大宗商品的历年价格变化',
         paper_bgcolor='#ccece6',margin=list(t=36,l=24))

TO: Blogs