I'm plotting several lines within a for block and I set the style of each line using matplotlib's dashes argument.
One (or more) of those lines needs to be continuous. I've found no way to draw such a line other than making a single extremely long dash, as seen in the MCVE below. This works, but feels rather hackish.
Is there a more "correct" way to achieve this?
(I know I can just use plt.plot() with no dashesargument to produce a continuous plot, but I need to produce a lot of custom styled lines, mixed with one or more continuos lines)
MCVE:
import matplotlib.pyplot as plt
import numpy as np
col = ['c', 'm', 'g', 'y', 'k']
c_dash = [[8, 4], [8, 4, 2, 4], [2, 2], [8, 4, 2, 4, 2, 4], [1000, 1]]
for i in range(5):
x, y = range(10), np.random.uniform(0., 10., 10)
plt.plot(x, y, color=col[i], dashes=c_dash[i])
plt.savefig('test.png', dpi=300)


plt.plot(x, y, '-')?dashesargument does not accept'-'.np.infseems to work.