Last active
November 6, 2018 08:41
-
-
Save rishi93/7d20441a9f160b422417adaa649ed3d5 to your computer and use it in GitHub Desktop.
Simple 2D plot in Matplotlib
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| # Create the figure and the axes | |
| fig = plt.figure() | |
| ax = fig.add_subplot(111, title = 'Sine wave') | |
| # Prepare the datapoints | |
| x = np.linspace(0, 2*np.pi, 100) | |
| y = np.sin(x) | |
| # Plot the data points | |
| plt.plot(x, y) | |
| # Display the plot | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment