~njansson/dolfin/hpc

« back to all changes in this revision

Viewing changes to bench/fem/passembly/plot.py

  • Committer: Johannes Ring
  • Date: 2008-03-05 22:43:06 UTC
  • Revision ID: johannr@simula.no-20080305224306-2npsdyhfdpl2esji
The BIG commit!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from pylab import *
 
2
 
 
3
if (size(sys.argv) < 3):
 
4
  print 'Usage:', sys.argv[0], '<title> <plotfile> [plotfile 2 ... plotfile n]'
 
5
  print """title - The plot title
 
6
           plotfile - Output file from the benchmark program
 
7
        """
 
8
  sys.exit(1)
 
9
 
 
10
plottitle = sys.argv[1]
 
11
 
 
12
for filename in sys.argv[2:]:
 
13
  file = open(filename, 'r')
 
14
  lines = file.readlines();
 
15
  linelabel = lines[0]
 
16
  axis = lines[1].split()
 
17
  (xname, yname) = (axis[0], axis[1])
 
18
  xarr = [(int)(lines[2].split()[0])]
 
19
  yarr = [lines[2].split()[1]]
 
20
  for line in lines[3:]:
 
21
    x = (int)(line.split()[0])
 
22
    y = line.split()[1]
 
23
    if x == xarr[-1]:
 
24
      if y > yarr[-1]:
 
25
        yarr[-1] = y
 
26
    else:
 
27
      xarr.append(x)
 
28
      yarr.append(y)
 
29
 
 
30
  #loglog(xarr, yarr, '-o', label=linelabel)
 
31
  plot(xarr, yarr, '-o', label=linelabel)
 
32
  legend(loc='best')
 
33
  file.close()
 
34
 
 
35
title(plottitle)
 
36
xlabel(xname)
 
37
ylabel(yname)
 
38
show()