plotConvergence.frink

View or download plotConvergence.frink in plain text format


/** This program takes the output from convergatron.frink (then split by
    planetsplit.sh) and draws a graph of the convergence. */

use Grid.frink

### yyyy-MM-dd-HH:mm ###
mfunc = {|date| date -> ### yyyy\nMM ###}

if length[ARGS] == 0
   println["Usage: frink plotConvergence [filenames]"]

for filename = ARGS
{
   g = new graphics
   g.font["Monospaced", 1 deg]

   p = new polyline
   var d
   
   for line = lines[filenameToURL[filename]]
   {
      cols = split["\t", line]
      d = parseDate[cols@0]
      sep = eval[cols@3] degrees
      p.addPoint[JD[d], -sep]
   }
   
   g.color[0,0,0,0]
   g.drawRectSides[JD[d], 0 deg, JD[d], 0 deg]
   
   g.color[0,0,0]
   g.add[p]

   grid = new Grid
   grid.font["Monospaced", .3 degree]

   grid.color[0,0,0,.2]
   grid.makeVerticalCalendarLines[g, Grid.MONTH, false, tz]
   
   grid.color[0,0,0,.6]
   grid.makeVerticalCalendarLabels[g, Grid.MONTH, false, tz, mfunc]

   grid.color[0,0,0,.2]
   grid.autoHorizontalLines[g, false, -deg, 10, 20]
   
   grid.color[0,0,0,.6]
   grid.autoHorizontalLabels[g, false, -deg, 10, 20]

   grid.color[0,0,0,.2]
   grid.stroke[.1 day]
   grid.makeVerticalCalendarLines[g, Grid.DAY_OF_MONTH, false, tz]
//   grid.makeHorizontalLines[g, 10 min/s, false]

   g.add[grid.getGrid[]]

   f2 = filename 
   f2 =~ %s/.txt$/.png/i
   g.write[f2, 1000, 800]
   
   f2 = filename
   f2 =~ %s/.txt$/.svg/i
   g.write[f2, 1000, 800]
   
   g.show[]
}


View or download plotConvergence.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 18659 days, 7 hours, 52 minutes ago.