Calmcode - matplotlib: lines

Lines

1 2 3 4 5 6 7 8 9

There are many settings available for lines specifically. The example below shows the usage of linestyle.

import numpy as np
import matplotlib.pylab as plt

x = np.linspace(0, 1.5, 100)
for i, style in [(1, ':'), (2, '-.'), (3, '--')]:
    y = x ** i
    plt.plot(x, y, label=f"power={i}", linestyle=style, color='gray', linewidth=1)
plt.legend();

Again, note the semi-colon at the end here.