How to add vertical lines for visual separation in pandas plot
import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.DataFrame(np.random.rand(9, 4), columns=['a', 'b', 'c', 'd']) df.plot.bar() plt.show()
How do I add separating vertical lines between groups? Say these are
groups of three:
(0, 1, 2), LINE, (3, 4, 5), LINE, (6, 7, 8)
This really helps for recognizing patterns and tracking trends in a busy, but useful graph.