# Making nice figures

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 close merge delete

Sort by » oldest newest most voted

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'

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


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


more