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

Auto plot labelling

Expand Messages
  • kevin mulholland
    I often am asked to chart CSV files in the form month,jan,feb,mar,apr... net,1,2,3,4 gross,2,3,4,5 I can use a #proc processdata to rotate the file into the
    Message 1 of 2 , Jan 28, 2002
    • 0 Attachment
      I often am asked to chart CSV files in the form

      month,jan,feb,mar,apr...
      net,1,2,3,4
      gross,2,3,4,5


      I can use a #proc processdata to rotate the file into the form that
      ploticus likes, but I would like to be able to take the label name for
      the line/bar/etc. from the 1st entry in the line (or colum when rotated)

      also the month entry should be used as the label for the X axis

      is this possible/feasible ?

      many thanks


      --
      Kevin Mulholland
      Principal Systems Engineer
      Siemens Metering Ltd
      mobile 00 44 780884 5979
      --
    • Stephen C. Grubb
      Kevin, One way to do this is demonstrated by the script below. It uses categories to do the months, which works if you won t have any months missing from your
      Message 2 of 2 , Jan 29, 2002
      • 0 Attachment
        Kevin,

        One way to do this is demonstrated by the script below.

        It uses categories to do the months, which works if you won't have any
        months missing from your data. If you could have missing months, you
        would need to use date scaling in X, which would require a year component
        in your month field.

        The curve labels are retrieved from the data set using the $dataitem
        function.

        It's a bit convoluted, and there are several new features in the works
        that will allow more flexibility with situations like this, but the
        following example should work for now:

        // read in the .csv data..
        #proc getdata
        delim: comma
        showresults: yes
        data:
        month,jan,feb,mar,apr
        net,1,2,3,4
        gross,2,3,4,5

        // rotate
        #proc processdata
        action: rotate
        showresults: yes

        // get the labels..
        #set LBL1 = $dataitem( 1, 2 )
        #set LBL2 = $dataitem( 1, 3 )

        // now remove the first row of data so that we can use field#1 as categories
        #proc processdata
        action: select
        select: @@1 != month

        // set up plotting area..
        #proc areadef
        xscaletype: categories
        xcategories: datafield=1
        yrange: 1 10
        xaxis.stubs: usecategories
        yaxis.stubs: inc

        // do red line..
        #proc lineplot
        xfield: 1
        yfield: 2
        linedetails: color=red
        legendlabel: @LBL1

        // do blue line..
        #proc lineplot
        xfield: 1
        yfield: 3
        linedetails: color=blue
        legendlabel: @LBL2

        // do legend..
        #proc legend




        On 28 Jan 2002, kevin mulholland wrote:

        > I often am asked to chart CSV files in the form
        >
        > month,jan,feb,mar,apr...
        > net,1,2,3,4
        > gross,2,3,4,5
        >
        >
        > I can use a #proc processdata to rotate the file into the form that
        > ploticus likes, but I would like to be able to take the label name for
        > the line/bar/etc. from the 1st entry in the line (or colum when rotated)
        >
        > also the month entry should be used as the label for the X axis
        >
        > is this possible/feasible ?
        >
        > many thanks
        >
        >
        > --
        > Kevin Mulholland
        > Principal Systems Engineer
        > Siemens Metering Ltd
        > mobile 00 44 780884 5979
        > --
        >
        >
        >
        > To unsubscribe from this group, send an email to:
        > ploticus-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        >
        >
        >


        Stephen C. Grubb scg@...
        Scientific Software Engineer, The Jackson Laboratory
        600 Main Street Bar Harbor, Maine 04609 USA
      Your message has been successfully submitted and would be delivered to recipients shortly.