Lesson 39 of 55 · Python
Data Visualization with Matplotlib
Duration: 20 minutes
Lesson 39 of 55 · Python
Duration: 20 minutes
python\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nx = np.linspace(0, 2*np.pi, 200)\nplt.plot(x, np.sin(x), label='sin(x)')\nplt.plot(x, np.cos(x), label='cos(x)')\nplt.title('Sine and Cosine Waves')\nplt.xlabel('x')\nplt.ylabel('y')\nplt.legend()\nplt.grid(True)\nplt.show()\n\n\nYou can customize colors, markers, subplots, and export figures with plt.savefig('plot.png').\n