# colorgrid2

How to download and try this example

    Usage: pl -gif [-map] colorgrid2.htm

    This color grid involves processing raw data by
    counting occurances within ranges, then mapping counts to colors by range.

    Uses data file snpmap.dat .
    For brevity, only chromosomes 1-7 and X are represented in this example.

    #set SYM = "radius=0.08 shape=square style=filled"
    #setifnotgiven CGI = "http://ploticus.sourceforge.net/cgi-bin/showcgiargs"

    #proc page
    backgroundcolor: black
    color: white

    // read in the SNP map data file..
    #proc getdata
    file: snpmap.dat
    fieldnameheader: yes

    // group into bins 10 cM wide..
    filter:
       ##set A = $numgroup( @@2, 10, mid )
       @@1 @@A

    // set up the plotting area
    #proc areadef
    rectangle: 1 1 6 3
    yscaletype: categories
    clickmapurl: @CGI?chrom=@@YVAL&cM=@@XVAL
    ycategories:
    	1
    	2
    	3
    	4
    	5
    	6
    	7
    	X

    yaxis.stubs: usecategories
    yaxis.stubdetails: adjust=0.2,0
    //yaxis.stubslide: 0.08
    yaxis.label: chromosome
    yaxis.axisline: no
    yaxis.tics: no
    yaxis.clickmap: xygrid

    xrange: -3 120
    xaxis.label: position (cM)
    xaxis.axisline: no
    xaxis.tics: no
    xaxis.clickmap: xygrid
    xaxis.stubs: inc 10
    xaxis.stubrange: 0
    xaxis.stubdetails: adjust=0,0.15

    // set up legend for color gradients..
    #proc legendentry
    sampletype: symbol
    details: fillcolor=yellow @SYM
    label: >40
    tag: 41

    #proc legendentry
    sampletype: symbol
    details: fillcolor=orange @SYM
    label: 31-40
    tag: 31

    #proc legendentry
    sampletype: symbol
    details: fillcolor=red @SYM
    label: 21-30
    tag: 21

    #proc legendentry
    sampletype: symbol
    details: fillcolor=lightpurple @SYM
    label: 11-20
    tag: 11

    #proc legendentry
    sampletype: symbol
    details: fillcolor=blue @SYM
    label: 1 - 10
    tag: 1

    // use proc scatterplot to count # of instances and pick appropriate color from legend..
    #proc scatterplot
    yfield: chr
    xfield: cM
    cluster: yes
    dupsleg: yes

    // display legend..
    #proc legend
    location: max-0.7 min+0.8
    textdetails: size=6