Spgraph Codes

For questions and discussion related to graphs, reports, and other output, including issues related to presenting or publishing results.

Spgraph Codes

Postby guo » Wed Sep 19, 2012 7:09 am

Dear Tom,

Always thank you very much for your kind help.

I'd like to put four graphs together by using Spgraph.

Here are the codes:
Code: Select all
set tvalues_i = tvalues_1,tvalues_4
set fvalues_i = fvalues_1,fvalues_4
spgraph(vfields=2,hfields=2,$
header="IM_CO, IM_CO_61, IM_CO_62 and IM_63",$
subtitle="The Relationship Between Theta and Inflation")
 do i = 1 , 4
  scatter
  # tvalues_i fvalues_i
  end do
spgraph(done)


Actually, the four graphs should be different. However, the four graphs in the same sheet are same.

Could you please tell me why this codes are wrong?

I am very looking forward to your kind answer.

Thank you very much.

Best Regards

guo
guo
 
Posts: 24
Joined: Wed Sep 28, 2011 7:43 am

Re: Spgraph Codes

Postby TomDoan » Wed Sep 19, 2012 10:27 am

tvalues_i is not the way to reference the ith element in a sequence. If you've already defined tvalues_1,...,tvalues_4 and the same for fvalues_?, then you want

scatter
# %s("tvalues_"+i) %s("fvalues_"+i)

If you haven't defined them, then you should probably be defining TVALUES and FVALUES as VECT[SERIES], that is

dec vect[series] tvalues(4) fvalues(4)
do i=1,4
set tvalues(i) = ....
set fvalues(i) = ....
end do i

...

scatter
# tvalues(i) fvalues(i)
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Spgraph code

Postby istiak » Mon Mar 18, 2013 12:25 am

Hi Tom
I am using spgraph option to create two graphs together. The codes are below.
spgraph(vfields=2)
graph(vlabel="Consumption",hlabel="time")
# c
graph(hlabel="Capital",hlabel="time")
# k
spgraph(done)
The code creates both consumption and capital graph in two rectangular boxes. If I need to get the graphs only with horizontal & vertical axis (I don't want north and east border of the box), how should I modify the above code? Thank you so much.
istiak
 
Posts: 3
Joined: Sun Nov 11, 2012 10:03 pm

Re: Spgraph code

Postby TomDoan » Mon Mar 18, 2013 10:59 am

istiak wrote:Hi Tom
I am using spgraph option to create two graphs together. The codes are below.

spgraph(vfields=2)
graph(vlabel="Consumption",hlabel="time")
# c
graph(hlabel="Capital",hlabel="time")
# k
spgraph(done)

The code creates both consumption and capital graph in two rectangular boxes. If I need to get the graphs only with horizontal & vertical axis (I don't want north and east border of the box), how should I modify the above code? Thank you so much.


Use the ROW and COL options on GRAPH:

spgraph(vfields=2)
graph(vlabel="Consumption",hlabel="time",row=1,col=1)
# c
graph(hlabel="Capital",hlabel="time",row=2,col=2)
# k
spgraph(done)
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Spgraph Codes

Postby istiak » Mon Mar 18, 2013 11:45 am

Hi Tom
I am sorry, I could not make my problem clear to you. I am attaching a graph. By default, rats creates graphs in a box (same as lower panel in my picture). But I want to get graphs like the upper panel, where only X and Y axis are present. Is there any code to do it? Thank you Tom.
Attachments
Doc1.pdf
(102.7 KiB) Downloaded 16 times
istiak
 
Posts: 3
Joined: Sun Nov 11, 2012 10:03 pm

Re: Spgraph Codes

Postby TomDoan » Mon Mar 18, 2013 12:18 pm

Sorry. What you want has nothing to do with SPGRAPH.

Each of the main graphics instructions (GRAPH, SCATTER, GCONTOUR, GBOX) has a FRAME option. The default is FRAME=FULL, which draws all four sides. You want FRAME=HALF, which does the left and lower only.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm


Return to Graphics, Reports, and Other Output

Who is online

Users browsing this forum: No registered users and 1 guest