Make xaxis discrete.
@@ -21,8 +21,8 @@ def traceplot(trace: sample_types,
label = vertex.get_label()
# Vertex#__repr__ is explicitly passed to avoid usage of overloaded operations in third party libraries
ax[index][0].set_title(vertex.__repr__() if label is None else label)
+ ax[index][0].plot(__get_discrete_xrange(x0, len(data)), data)
- ax[index][0].plot(range(x0, x0 + len(data)), data)
plt.pause(0.1)
return ax
@@ -33,3 +33,9 @@ def make_1d(a: numpy_types) -> numpy_types:
# collapse array in row-major (C-style) order
# see: https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.flatten.html
return a.flatten(order='C')
+
+
+def __get_discrete_xrange(x0: int, xn: int):
+ xint = range(x0, x0 + xn)
+ plt.xticks(xint)
+ return xint
