Question on Linear Plott

For questions and discussion related to graphs, reports, and other output, including issues related to presenting or publishing results.
cyang40
Posts: 9
Joined: Tue Apr 26, 2016 3:30 pm

Question on Linear Plott

Unread post by cyang40 »

Dear Tom,

Is there a way to restrict the axes of a linear plot without distorting the linear lines? As you can see in the attachment (linear_plot_2.jpg), when I restrict the vertical axis (vmin=0), the output is not the same as I expected. Ideally, I would like to focus on the positive section of the vertical axis. The code is provided below. Thank you very much.

Code: Select all

panel(entry=0, indiv=1, time=0) open_ca / finan_i

preg(title="OLS w. Country and Time FE",effects=both,method=fixed) growth 1//1971:1 51//2011:1
# govt opentg openfg openg
set m_fe_t20 1//1971:1 51//2011:1 = %beta(1)+%beta(2)*0.2+%beta(3)*finan_i+%beta(4)*0.2*finan_i
set m_fe_t40 1//1971:1 51//2011:1 = %beta(1)+%beta(2)*0.4+%beta(3)*finan_i+%beta(4)*0.4*finan_i
set m_fe_t80 1//1971:1 51//2011:1 = %beta(1)+%beta(2)*0.8+%beta(3)*finan_i+%beta(4)*0.8*finan_i
set m_fe_t120 1//1971:1 51//2011:1 = %beta(1)+%beta(2)*1.2+%beta(3)*finan_i+%beta(4)*1.2*finan_i

set fopen = finan_i*100

*Unrestricting the boundary (for graph please see attachment 1)

scatter(style=lines,header="Financial Openness and Fiscal Multiplier",$
klabel=||"TOPEN=20%","TOPEN=40%","TOPEN=80%","TOPEN=120%"||,key=below,$
hlabel="Financial Openness (%)",vlabel="Multiplier") 4
# fopen m_fe_t20
# fopen m_fe_t40
# fopen m_fe_t80
# fopen m_fe_t120

*Restricting the boundary (for graph please see attachment 2)

scatter(style=lines,header="Financial Openness and Fiscal Multiplier",$
klabel=||"TOPEN=20%","TOPEN=40%","TOPEN=80%","TOPEN=120%"||,key=below,vmin=0,$
hlabel="Financial Openness (%)",vlabel="Multiplier") 4
# fopen m_fe_t20
# fopen m_fe_t40
# fopen m_fe_t80
# fopen m_fe_t120
Sincerely,

Michael Yang
Attachments
Restricted Linear Plot
Restricted Linear Plot
linear_plot_2.jpg (70.16 KiB) Viewed 7410 times
Unrestricted Linear Plot
Unrestricted Linear Plot
linear_plot_1.jpg (55.86 KiB) Viewed 7410 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Question on Linear Plott

Unread post by TomDoan »

The problem is that you're doing that by STYLE=LINES with an unsorted "X" value. Your second graph actually is a huge number of line segments back and forth---you can only barely detect that because they all line up.

Since the data aren't actually important, you should just create your own "X' series which has the run of values that you want for the x-axis (use @GRIDSERIES) and compute the lines using that instead of finan_i.
cyang40
Posts: 9
Joined: Tue Apr 26, 2016 3:30 pm

Re: Question on Linear Plott

Unread post by cyang40 »

Thank you for the advice, Tom.
Post Reply