# Python 3.11 --  demo matplotlib showing presentations of data
# Provided by Anthony Vogelaar, Perth Scotland
# rev 0.10  2024-05-01  initial release

import  os;                 os.system('clear')
import  numpy               as  np
import  matplotlib.pyplot   as  plt

# Scatter plot
class Img1:

    def __init__(self):
        fig, ax = plt.subplots(figsize=(6, 6), facecolor='lightskyblue', layout='constrained')
        x = np.random.uniform(0, 1, 100)
        y = np.random.uniform(0, 1, 100)
        ax.scatter(x, y)
        plt.show()


# Bar plot
class Img2:

    def __init__(self):
        fig, ax = plt.subplots(figsize=(6, 6), facecolor='lightskyblue', layout='constrained')
        x = np.arange(10)
        y = np.random.uniform(1, 10, 10)
        ax.bar(x, y)
        plt.show()


# Image plot
class Img3:

    def __init__(self):
        fig, ax = plt.subplots(figsize=(6, 6), facecolor='lightskyblue', layout='constrained')
        z = np.random.uniform(0, 1, (8, 8))
        print('z:', z)
        ax.imshow(z)
        plt.show()


# Contour plot
class Img4:

    def __init__(self):
        fig, ax = plt.subplots(figsize=(6, 6), facecolor='lightskyblue', layout='constrained')
        z = np.random.uniform(0, 1, (8, 8))
        ax.contourf(z)
        plt.show()


# Pie plot
class Img5:

    def __init__(self):
        fig, ax = plt.subplots(figsize=(6, 6), facecolor='lightskyblue', layout='constrained')
        z = np.random.uniform(0, 1, 4)
        ax.pie(z)
        plt.show()


# Histogram plot
class Img6:

    def __init__(self):
        fig, ax = plt.subplots(figsize=(6, 6), facecolor='lightskyblue', layout='constrained')
        # z = np.random.uniform(0, 1, 1000)
        z = np.random.normal (0, 1, 1000)
        ax.hist(z)
        plt.show()


# Error plot
class Img7:

    def __init__(self):
        fig, ax = plt.subplots(figsize=(6, 6), facecolor='lightskyblue', layout='constrained')
        x = np.arange(5)
        y = np.random.uniform (0, 1, 5)
        ax.errorbar(x, y, y/4)
        plt.show()


# Box plot
class Img8:

    def __init__(self):
        fig, ax = plt.subplots(figsize=(6, 6), facecolor='lightskyblue', layout='constrained')
        z = np.random.normal (0, 1, (100, 3))
        print('z:', z)
        ax.boxplot(z)
        plt.show()


Img8()
