Last active
November 6, 2018 08:42
-
-
Save rishi93/3b0fda6f8c9ae35a82c8e253b9bd358f to your computer and use it in GitHub Desktop.
Simple 3D 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 | |
| from mpl_toolkits import mplot3d | |
| # Create the figure and the axes | |
| fig = plt.figure() | |
| ax = fig.add_subplot(111, projection = '3d', title = 'A 3D curve') | |
| # Prepare the data points | |
| z = np.linspace(-4*np.pi, 4*np.pi, 100) | |
| x = np.sin(z) | |
| y = np.cos(z) | |
| # Plot the data points | |
| ax.plot(x, y, z) | |
| # Display the plot | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment