Three-Dimensional Plotting in Python Using Matplotlib
Three-Dimensional Plotting in Python Using Matplotlib
Three-Dimensional Plotting in Python Using Matplotlib
With Example
by Akash Singh
by Alash Singh
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax = plt.axes(projection='3d')
fig = plt.figure()
# plotting
ax.plot3D(x, y, z, 'purple')
ax.set_title('3D line plot')
plt.show()
by Alash Singh
fig = plt.figure()
# defining axes
z = np.linspace(0, 1, 100)
x = z * np.sin(25 * z)
y = z * np.cos(25 * z)
c=x+y
ax.scatter(x, y, z, c = c)
# importing libraries
from mpl_toolkits import mplot3d
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
# x and y axis
x = np.linspace(-1, 5, 10)
y = np.linspace(-1, 5, 10)
X, Y = np.meshgrid(x, y)
Z = f(X, Y)
fig = plt.figure()
ax = plt.axes(projection ='3d')
ax.plot_wireframe(X, Y, Z, color ='purple')
ax.set_title('wireframe');
X, Y = np.meshgrid(x, y)
Z = function(X, Y)
ax.plot_surface(X, Y, Z, cmap='cool',
alpha=0.8)
plt.show()
by Alash Singh
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
by Akash Singh
Click here to get connected!!