SHAZAM Community
Ask Your Question
1

Making nice figures

asked 2012-07-17 08:56:57 +0000

Pantera gravatar image

Hi all,

It is often we need to use two y-axes to illustrate how two variables develop over a given time period. Let’s say we have two variables y(t) and x(t) for the time period t to T and want to use two y-axes. Question: Is it possible to make a graph (use the graph-function) in Shazam to plot a figure with two y-axes where for example y(t) is referred to the left y(t)-axis and x(t) to the right y-axis?

Best regards.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2012-07-19 16:20:44 +0000

updated 2012-07-19 18:04:05 +0000

Some of the graphs produced by the financial functions PORT and STOCK do this automatically. To do this with the GRAPH command you can easily edit the graph script from the 'Edit Source' button on the Graph Viewer to do this yourself - adding using the 'Edit Data' button should you need to.

Here is a simple example where we both add data, y axes labels and a second axis by hand to an existing graph.

1) Open SHAZAM 11 and then open the 'Introduction' on the Help menu.

2) Open the Dynamic VAR.gnu Graph and click 'Edit Data'

Add an additional column (column 3 below) Adding an extra variable

3) Click 'Edit Source' and adjust the graph as follows:

Before:

 # SHAZAM COMMAND:GRAPH   
 set samples  26
 set title " Dynamic Forecast from VAR(1) Model for last 25 Obs of Y        "
 set key
 set xlabel "TIME    "
 set ylabel
 plot  "Dynamic VAR_1.shd" using 1 lw 2 title "Y1    " w linespoint,\
       "Dynamic VAR_1.shd" using 2 lw 2 title "PREDY1" w linespoint  
 quit

Before change

After:

 # SHAZAM COMMAND:GRAPH   
 set samples  26
 set title " Dynamic Forecast from VAR(1) Model for last 25 Obs of Y        "
 set key
 set xlabel "TIME    "
 set ylabel "VAR"
 # ADD 2ND AXES AND PLOT CONST
 set y2label "CONST"
 set y2range [-15:100]
 set y2tics 20 nomirror tc lt 2
 plot "Dynamic VAR_1.shd" using 1 lw 2 title "Y1      "  w linespoint,\
      "Dynamic VAR_1.shd" using 2 lw 2 title "PRED_Y1  "  w linespoint,\
      "Dynamic VAR_1.shd" using 3 lw 2 title "CONST_Y2 " w linespoints axes x1y2  
 quit

After the edit

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2012-07-17 08:56:57 +0000

Seen: 632 times

Last updated: Jul 19 '12