I try to visualise multiple function coming from the single parameter. I need to do some kind of loop over parameter. I would like to do assign the same colour, legend etc to all plotted functions of given parameter.
The problem is that all plots I try, matplotlib assign different colours and always give a label.
Basicaly I would like to achive something like:
import numpy as np
import matplotlib.pyplot as plt
def plot2():
fig, ax = plt.subplots()
x = np.arange(0,10,0.1)
ax.plot(x,1*np.sin(x),'b-')
ax.plot(x,1*np.cos(x),'b-',label='trig a={}'.format(1))
ax.plot(x,2*np.sin(x),'g-')
ax.plot(x,2*np.cos(x),'g-',label='trig a={}'.format(2))
ax.plot(x,3*np.sin(x),'r-')
ax.plot(x,3*np.cos(x),'r-',label='trig a={}'.format(3))
ax.legend()
but with function like:
def plotTrig():
fig, ax = plt.subplots()
x = np.arange(0,10,0.1)
for a in [1,2,3]:
ax.plot(x,a*np.sin(x),x,a*np.cos(x),label='trig a={}'.format(a))
ax.legend()
above is only simplified example. In practice I have much more functions and parameters, so solution with looping over colors is not very helpful

ax.plot(x,a*np.sin(x),x,a*np.cos(x), '-ks' ,label='trig a={}'.format(a)). Notice the addition of'-ks': that is a black (k), solid line (-) with squares (s) where the values are. You can change that to the style you want and every plot will have the same style.