   for i in data.chr
     currentMax = d3.max(data.lod[i].lod)
     maxLod = currentMax if maxLod < currentMax
+
+  # for each chromosome, find the marker with maximum LOD score
+  maxLodByChr = {}
+  maxLodByChr_marker = {}
+  for i in data.chr
+    maxLodByChr[i] = 0
+    maxLodByChr[i] = ""
+    for m of data.markerindex[i]
+      lod = data.lod[i].lod[data.markerindex[i][m]]
+      if lod > maxLodByChr[i]
+        maxLodByChr[i] = lod
+        maxLodByChr_marker[i] = m
 
   # maximum effect + SE and minimum effect - SE
   effMax = null

                          .attr("stroke", "black")
                          .attr("stroke-width", "1")


  # chr labels
  topsvg.append("g").attr("id", "chrLabels").selectAll("empty")

  randomDraw = (x) -> x[Math.floor(Math.random()*x.length)]

  randomChr = randomDraw(data.chr)
  randomMarker = maxLodByChr_marker[randomChr]

  # initial phenotype vs genotype plot
  initialPXG = (chr, marker) ->
