Loading ...
Sorry, an error occurred while loading the content.

RE: [ploticus] problem with #proc bars

Expand Messages
  • Stephen Grubb
    Hello, 1) see proc axis stubvert attribute for the labels 2) you can plot using different Y axis scales. The approach would be areadef plot areadef plot
    Message 1 of 2 , Apr 27 11:27 AM
    • 0 Attachment
      Hello,

      1) see proc axis "stubvert" attribute for the labels

      2) you can plot using different Y axis scales. The approach would be

      areadef
      plot

      areadef
      plot

      areadef
      plot

      where each areadef would use the exact same rectangle and xscale, but the yscale would vary. the location of the yaxis would also vary (to prevent the 3 y axes from being on top of one another)

      Examples: http://ploticus.sourceforge.net/gallery/sa13.htm

      http://ploticus.sourceforge.net/gallery/three_axes.htm

      Steve

      ________________________________________
      From: ploticus@yahoogroups.com [ploticus@yahoogroups.com] On Behalf Of danmc91_93_01 [mcmahill@...]
      Sent: Thursday, March 26, 2009 8:53 PM
      To: ploticus@yahoogroups.com
      Subject: [ploticus] problem with #proc bars

      Hello,

      I'm new to ploticus and am trying to make the following plot. I have a list of 15-20 different global ecosystems (tropical rain forest, boreal forest, open ocean, etc). For each of those I have 3 or 4 variables I want to plot. My vision is a bar chart that has 3 or 4 different colored bars for each ecosystem. I am mostly there but have 2 problems.

      1) I can't seem to rotate the text that labels the ecosystems.

      2) I need to use different y-axis scales for each of my 3 or 4 variables because they are in different units and have different numerical ranges.

      I want them all on the same plot though because for example tropical rain forest is really high on one variable and really low on another relative to everything else.

      Any suggestions? My files are attached.

      npp.dat:
      --------------------------------------------
      Ecosystem Area Mean_NPP World_NPP Mean_Biomass
      "Tropical rain forest (@@PCT%)" 17.0 2000.0 34.0 44.0
      "Tropical seasonal forest (@@PCT%)" 7.5 1500.0 11.3 36.0
      "Tropical evergreen forest (@@PCT%)" 5.0 1300.0 6.4 36.0
      "Tropical deciduous forest (@@PCT%)" 7.0 1200.0 8.4 30.0
      "Boreal forest (@@PCT%)" 12.0 800.0 9.5 20.0
      "Savanna (@@PCT%)" 15.0 700.0 10.4 4.0
      "Cultivated Land (@@PCT%)" 14.0 644.0 9.1 1.1
      "Woodland and shrubland (@@PCT%)" 8.0 600.0 4.9 6.8
      "Temperate grassland (@@PCT%)" 9.0 500.0 4.4 1.6
      "Tundra and alpine meadow (@@PCT%)" 8.0 144.0 1.1 0.67
      "Desert shrub (@@PCT%)" 18.0 71.0 1.3 0.67
      "Rock, ice, sand (@@PCT%)" 24.0 3.3 0.09 0.02
      "Swamp and marsh (@@PCT%)" 2.0 2500.0 4.9 15.0
      "Lake and stream (@@PCT%)" 2.5 500.0 1.3 0.02

      --------------------------------------------

      npp.htm
      --------------------------------------------

      #set COLORLIST = red,yellow,blue,green,orange,pink,black,white

      #proc settings
      encodenames: yes

      #proc page
      pagesize: 7 4
      #if @DEVICE in gif,png
      scale: 0.6
      #endif

      #proc getdata
      fieldnameheader: yes
      file: npp.dat // data file
      delim: whitespace // how records are delimited
      #endproc //necessary in order to do the following computation involving NRECORDS

      // compute XMAX (number of records+1 for bar graphs)
      #set XMAX = $arith(@NRECORDS+1)

      // set up area
      #proc areadef
      title: Net Primary Productivity of World Ecosystems
      rectangle: 1 1 6 3
      xrange: 0 @XMAX
      yrange: 0 2000 // no way currently to do autorange on variable # of fields
      xaxis.stubs: datafield=1
      xaxis.label: Ecosystem
      yaxis.stubs: inc 10
      yaxis.label: Various

      // initialize loop variables
      #set I = 3
      #set NCLUST = $arith(@NFIELDS-2)

      // start loop
      #loop

      // set vars for this iteration
      #set FNAME = $fieldname(@I) // this function is new
      #set ICLUST = $arith(@I-2)
      #set COLOR = $nmember(@ICLUST,@COLORLIST)

      // do bars
      #proc bars
      lenfield: @I
      cluster: @ICLUST / @NCLUST
      color: @COLOR
      longwayslabel: yes
      labelrot: 90
      showvalues: yes
      #hideund
      legendlabel: @FNAME
      #showund
      barwidth: 0.1

      // update I and see if time to stop..
      #set I = $arith(@I+1)
      #if @I > @NFIELDS
      #break
      #endif
      #endloop

      // slap on the legend
      #proc legend
      format: singleline
      location: 1 0.5
      sep: 0.5

      --------------------------------------------
    Your message has been successfully submitted and would be delivered to recipients shortly.