Skip to content
Snippets Groups Projects
line_plot.py 560 B
import numpy as np
import matplotlib.pyplot as plt
 
# set width of bar
barWidth = 0.10


def do_plot(x_values, y_values, y_labels, colors, x_label, invert=False):
    num_lines = len(y_values)
    npts = len(x_values)

    for k in range(num_lines):
        # plt.plot(y_values[k], x_values, color=colors[k], label=y_labels[k])
        plt.plot(x_values, y_values[k], color=colors[k], label=y_labels[k])
    plt.xlabel(x_label, fontweight='bold')

    if invert:
        plt.gca().invert_yaxis()
    # create and show graphic
    plt.legend()
    plt.show()