Categorical graph by observsation?

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

blb22
Posts: 9
Joined: Wed Mar 29, 2017 6:40 am

Categorical graph by observsation?

Postby blb22 » Wed Jul 24, 2019 6:21 am

Hi,

I'm trying to draw a graph like the below. I have 3 or 4 time series objects, and want to draw a bar graph using the last two observations.

Image

I've tried categorical graphs, but I can't quite seem to get there...

Thanks

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13600
Joined: Tue Sep 16, 2008 5:38 pm

Re: Categorical graph by observsation?

Postby EViews Gareth » Wed Jul 24, 2019 8:33 am

Its possible, but requires a fair bit of silly manipulation, involving stacking the series into a panel, removing all the other dates, creating a series containing quarter number, then removing panel structure and then doing a categorical graph by quarter, and adding some colours/labels etc... Here's an example:

Code: Select all

create q 2018 2020 series gdp=nrnd gdp.displayname GDP series cons=nrnd cons.displayname Cons series invest=nrnd invest.displayname Invest series govt=nrnd govt.displayname Govt series invent=nrnd invent.displayname Invent series nettrade=nrnd nettrade.displayname Net Trade smpl 2019q1 2019q1 gdp = 3.2 cons=0.8 invest=0.3 govt=0.4 invent=0.7 nettrade=1 smpl 2019q2 2019q2 gdp=1.4 cons=1.8 invest=0.8 govt=-0.1 invent=-0.9 nettrade=-0.1 'add a name suffix to enable stacking rename * *_val 'stack pagestack(page=graph) ?_val @ ?* * 'create quarter series series q = @quarter 'remove other dates pagecontract 2019q1 2019q2 'remove panel structure pagestruct(none) 'create labelling alpha alpha labels = @str(@trend) smpl if @mod(@trend,2) = 0 labels = var01 smpl @all 'create a sort order so the series are in the order we want them (rather than alphabetical) series sort sort.fill 3,4,1,2,7,8,9,10,5,6,11,12 pagesort sort pagestruct labels freeze(mygraph) _val.bar within(q) mygraph.datelabel interval(obs, 2, 1)

blb22
Posts: 9
Joined: Wed Mar 29, 2017 6:40 am

Re: Categorical graph by observsation?

Postby blb22 » Tue Jul 30, 2019 4:57 am

Thanks. Is there a way to increase the size of the labels above each bar?


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests