2

I am setting up a plot for multiple lines using a for loop. However, I would like to use more than the four standard linestyles (e.g ':', '--' etc). From here I understand I can create custom linestyles using the dashes argument.

There are four default linestyles. I set the styles using the code below which works

linestyles = ['-', '--', '-.', ':']
plt.figure()
for indx in range(4):
     plt.plot(range(10), range(10), linestyle=linestyles[indx])

and the same would work if I switched to setting the dashes argument e.g

dashes = [[3,6,3,6,3,18],[12,6,12,6,3,6],[12,6,3,6,3,6]]
plt.figure()
for indx in range(4):
     plt.plot(range(10), range(10), dashes=dashes[indx]

however, I would like it such that the first four lines use the standard linestyles and lines after this use the dash styles. Is there an efficient way to do this? Ideally, the solution would use a single list of n linestyles that could also be cycled over as given here. Thanks

J976
  • 41
  • 3

0 Answers0