Note
Click here to download the full example code
Plotting the exponential function¶
A simple example for ploting two figures of a exponential function in order to test the autonomy of the gallery stacking multiple images.
# Code source: Óscar Nájera
# License: BSD 3 clause
import numpy as np
import matplotlib.pyplot as plt
def main():
    x = np.linspace(-1, 2, 100)
    y = np.exp(x)
    plt.figure()
    plt.plot(x, y)
    plt.xlabel('$x$')
    plt.ylabel('$\exp(x)$')
    plt.figure()
    plt.plot(x, -np.exp(-x))
    plt.xlabel('$x$')
    plt.ylabel('$-\exp(-x)$')
    plt.show()
if __name__ == '__main__':
    main()
Total running time of the script: ( 0 minutes 0.000 seconds)