SHAZAM Community
Ask Your Question

Revision history [back]

Some of the graphs produced by the financial functions PORT and STOCK do this automatically but the GRAPH command won't do this for general data graphs. However you can easily edit the graph script from the 'Edit Source' button on the Graph Viewer to do this yourself, adding the data using the 'Edit Data' button.

Use the gnuplot commands here is a simple example - note the commands related to "y2..." and the plot statement declaring which function uses which y axis:

set xrange [-10:10]
set ytics 10 nomirror tc lt 1
set ylabel '2*x' tc lt 1
set y2tics 20 nomirror tc lt 2
set y2label '4*x' tc lt 2
plot 2*x linetype 1, 4*x linetype 2 axes x1y2

Source: http://stackoverflow.com/questions/2827650/plotting-two-axes-in-gnuplot

click to hide/show revision 2
Used a better example

Some of the graphs produced by the financial functions PORT and STOCK do this automatically but automatically. To do this with the GRAPH command won't do this for general data graphs. However you can easily edit the graph script from the 'Edit Source' button on the Graph Viewer to do this yourself, yourself - adding the data using the 'Edit Data' button.

Use the gnuplot commands here button should you need to.

Here is a simple example - note the commands related where we both add data, y axes labels and a second axis by hand to "y2..." and the plot statement declaring which function uses which y axis: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:

set xrange [-10:10]
set ytics 10 nomirror tc lt 1
 # 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 '2*x' tc lt 1
"VAR"
 # ADD 2ND AXES AND PLOT CONST
 set y2label "CONST"
 set y2range [-15:100]
 set y2tics 20 nomirror tc lt 2
set y2label '4*x' tc lt 2
 plot 2*x linetype 1, 4*x linetype 2 "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
x1y2  
 quit

Source: http://stackoverflow.com/questions/2827650/plotting-two-axes-in-gnuplot

After the edit