瀏覽代碼

grass.benchmark: fix nprocs plot ticks to be integers (#2242)

Anna Petrasova 3 年之前
父節點
當前提交
01e30f719e
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      python/grass/benchmark/plots.py

+ 6 - 0
python/grass/benchmark/plots.py

@@ -71,6 +71,12 @@ def nprocs_plot(results, filename=None, title=None):
     # ticks when there is a lot of x values.
     if len(x_ticks) < 10:
         axes.set(xticks=sorted(x_ticks))
+    else:
+        from matplotlib.ticker import (  # pylint: disable=import-outside-toplevel
+            MaxNLocator,
+        )
+
+        axes.xaxis.set_major_locator(MaxNLocator(integer=True))
     plt.xlabel("Number of processing elements (cores, threads, processes)")
     plt.ylabel("Time [s]")
     if title: