Plotting graphics with functions in 3D matplotlib

Asked

Viewed 399 times

1

Good night, you guys! I need to plot an area graph where the height z varies according to any function and its interval depends on the initial point and the final point reported. I found the example below on the internet, but I do not know how to change it so that the chart complies with my imposed conditions. How can I proceed? Thank you in advance.

from mpl_toolkits.mplot3d import Axes3D
from matplotlib.collections import PolyCollection
from matplotlib.colors import colorConverter
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
ax = fig.gca(projection='3d')
t  = np.arange(1024)*1e-6
y1 = np.sin(t*2e3*np.pi) 
verts=[list(zip(t, y1))]

poly = PolyCollection(verts, facecolors = ['r','g','b'])
poly.set_alpha(0.7)
ax.add_collection3d(poly, zs=zs, zdir='y')
ax.set_xlabel('X')
ax.set_xlim3d(0, 1024e-6)

plt.show()
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.