# stackedarea

How to download and try this example

    Usage: pl -gif stackedarea.htm

    //
    // demonstrates a script approach to stacked area plots.. note that the
    // filter is set up for 4 levels.. and a change in the number of levels
    // requires adjusting the code..
    //
    // the stack prefab is generally an easier way to go for up to 4 levels
    // (this code was actually derived from that)

    #proc getdata
     file: ../pltestsuite/data5
     delim: tab
     fieldnameheader: yes

     filter:
      ##set X = $ref(1)
        ##set R4 = $ref(5)
        ##set R3 = $ref(4)
        ##set R2 = $ref(3)
      ##set R1 = $ref(2)
        ##set OUT4 = $arithl(@R1+@R2+@R3+@R4)
        ##set OUT3 = $arithl(@R1+@R2+@R3)
        ##set OUT2 = $arithl(@R1+@R2)
        ##print @X	@R1	@OUT2	@OUT3	 @OUT4

    #endproc

    #proc areadef
      rectangle: 1 2 5.5 4
      xscaletype: categories
      xcategories: datafield=1
      catcompmethod: exact
      yautorange: datafields=2,3,4,5 combomode=normal incmult=2.0  nearest=auto

    #proc xaxis
      stubs: inc
      stubrange: 0
      stubvert: yes
      stubcull: yes
      stubs: usecategories

    #proc yaxis
      stubs: inc
      stubcull: yes

    #proc lineplot
     xfield: 1
     yfield: 5
     fill: drabgreen
     legendlabel: pacific

    #proc lineplot
     xfield: 1
     yfield: 4
     fill: dullyellow
     legendlabel: mountain

    #proc lineplot
     xfield: 1
     yfield: 3
     fill: powderblue
     legendlabel: central

    #proc lineplot
    xfield: 1
    yfield: 2
    fill: orange
    legendlabel: eastern

    #proc legend
    location: min+0.5 max+0.5