""" Example saving a figure """ import matplotlib.pyplot as plt import pathlib HERE = pathlib.Path(__file__).parent def create_graph(): x = [1, 2, 3] y = [2, 4, 6] plt.plot(x, y) plt.savefig(HERE.joinpath("mygraph.png")) if __name__ == "__main__": print(HERE) create_graph()