You could create a lighter color in place of using alpha
for transparency. You can do that as explained in this answer: you can define a function to which to pass two parameters:
- the name of the color you want to use,
'blue'
for example
- a value which indicates the lightness of the color;
- 0 total black
- 1 natural color (
'blue'
as is)
- 2 total white
In your case you can use a value of 1.9
in order to keep the color very light.
Complete Code
import matplotlib.pyplot as plt
import numpy as np
N = 10
x = np.linspace(0, 1, N)
def adjust_lightness(color, amount=0.5):
import matplotlib.colors as mc
import colorsys
try:
c = mc.cnames[color]
except:
c = color
c = colorsys.rgb_to_hls(*mc.to_rgb(c))
return colorsys.hls_to_rgb(c[0], max(0, min(1, amount * c[1])), c[2])
fig, ax = plt.subplots()
for i in range(20):
y = np.random.randn(N)
ax.plot(x, y, color = adjust_lightness('blue', 1.9), linewidth = 3)
plt.show()
