瀏覽代碼

Make perf2tex draw labels for all components of stacked bars

jonathanvdc 8 年之前
父節點
當前提交
e6e706ac38
共有 1 個文件被更改,包括 8 次插入8 次删除
  1. 8 8
      performance/perf2tex.py

+ 8 - 8
performance/perf2tex.py

@@ -153,11 +153,13 @@ def assemble_stacked_latex_chart(optimization_levels,
         label style={font=\footnotesize},
         ylabel={Time},
         y unit=s,
-        area legend
+        area legend,
+        nodes near coords,
+        every node near coord/.append style={rotate=90, anchor=west}
     ]""" % (len(optimization_levels), bar_width, ','.join(
         [encode_latex_string(name) for name in optimization_levels] *
         len(test_names))))
-    for j, (quantity, points) in enumerate(data):
+    for quantity, points in data:
         contents = []
         i = 0
         for _, test_data in flip_tuple_keys(points):
@@ -167,12 +169,10 @@ def assemble_stacked_latex_chart(optimization_levels,
             i += 1
 
         lines.append(r"""
-        \addplot[style={%s,fill=%s,mark=none}%s]
-            coordinates {%s};""" % (
-            quantity_color_names[quantity], quantity_color_names[quantity],
-            ",nodes near coords,"
-            "every node near coord/.append style={rotate=90, anchor=west,color=black}"
-            if j == len(data) - 1 else "", ' '.join(contents)))
+        \addplot[style={%s,fill=%s,mark=none}]
+            coordinates {%s};""" %
+                     (quantity_color_names[quantity],
+                      quantity_color_names[quantity], ' '.join(contents)))
     lines.append(r"""
         \legend{%s}""" % ','.join(map(encode_latex_string, quantity_names)))
     lines.append(r"""