Browse Source

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

Anna Petrasova 3 years ago
parent
commit
01e30f719e
1 changed files with 6 additions and 0 deletions
  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: