Browse Source

Display the labels above plots

check-vt100
Aleksander Kiryk 4 years ago
parent
commit
bebcc20fe6
  1. 16
      graph.py

16
graph.py

@ -75,7 +75,7 @@ def g(command):
# Plot a single column of values from data.txt
def plot(ylabel, title, session, column):
g(f"set ylabel '{ylabel}'")
g(f"set title '{title}'")
g(f"set title \"{title}\\n\\n\\n\"")
g(f"plot '{session}.txt' using 1:{column}:{column} title 'cpu' with boxes palette")
@ -252,20 +252,20 @@ def graph(session, fname='plot.png'):
i = 0
for label in labels:
if i%2 == 0:
height = 0.90
height = 1.20
else:
height = 0.83
height = 1.12
i = i + 1
g(f"set arrow nohead from '{label[0]}', graph 0.01 to '{label[0]}', graph {height-0.06} front lc rgb 'red' dt 2")
g(f"set arrow nohead from '{label[0]}', graph 0.01 to '{label[0]}', graph {height-0.05} front lc rgb 'red' dt 2")
g(f"set object rect at '{label[0]}', graph {height-0.03} size char {len('%d' % i)+1}, char 1 fc rgb 'red'")
g(f"set object rect at '{label[0]}', graph 0.0 size char 0.5, char 0.5 front fc rgb 'red'")
g(f"set label at '{label[0]}', graph {height-0.02} '{i}' center tc rgb 'black' font 'Courier-New,7'")
g(f"set label at '{label[0]}', graph {height+0.05} '{label[1][0:30]}' center tc rgb 'white' font 'Courier-New,7'")
g(f"set object rect at '{label[0]}', graph 0.0 size char 0.5, char 0.7 front fc rgb 'red'")
g(f"set label at '{label[0]}', graph {height-0.03} '{i}' center tc rgb 'black' font 'Courier-New,7'")
g(f"set label at '{label[0]}', graph {height+0.07} '{label[1][0:30]}' center tc rgb 'white' font 'Courier-New,7'")
if i > 0:
g("set yrange [0:139]")
g("set yrange [0:100]")
else:
g("set yrange [0:100]")

Loading…
Cancel
Save