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 Jason, EViews Steve, EViews Moderator

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

Categorical graph by observsation?

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


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.


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


EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12460
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

smpl 2019q2 2019q2

'add a name suffix to enable stacking
rename * *_val
pagestack(page=graph) ?_val @ ?* *
'create quarter series
series q = @quarter
'remove other dates
pagecontract 2019q1 2019q2

'remove panel structure
'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) within(q)
mygraph.datelabel interval(obs, 2, 1)
Follow us on Twitter @IHSEViews

Posts: 6
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 7 guests