# Python 3.11 --  demo matplotlib showing three plots with legend
# Provided by Anthony Vogelaar, Perth Scotland
# rev 0.10  2024-05-01  initial release

import matplotlib.pyplot as plt
import numpy             as np

class Img:

    def __init__(self):
        x  = np.linspace(0, 2, 10)          # Create ndarray for x-axis
        y1 = x
        y2 = x**2
        y3 = x**3

        fig, ax = plt.subplots(figsize=(4, 3), facecolor='lightskyblue', layout='constrained')
        ax.set_xlabel("X label")
        ax.set_ylabel("Y label")
        ax.plot(x, y1, label="linear")
        ax.plot(x, y2, label="quadratic")
        ax.plot(x, y3, label="cubic")
        ax.legend()

        plt.suptitle("Triple function plot")
        plt.show()


Img()
