Want to bring trigonometry to life? With Matplotlib, you can easily plot the sine and cosine functions on the same graph, creating an intuitive visualization of their periodic nature.
- π About This Project
- π Code Preview
- πΈ Output Preview
- π― How to Run
- π Future Improvements
- π€ Contributing
- π License
- π© Contact
- π About This Project This repository contains a simple yet powerful Python script that: β Plots the sine and cosine functions over a defined range β Uses Matplotlib for high-quality graph rendering β Highlights key aspects of wave behavior, such as phase shifts and symmetry
π Code Preview
import numpy as np import matplotlib.pyplot as plt
x = np.linspace(0, 2 * np.pi, 100)
y_sin = np.sin(x) y_cos = np.cos(x)
plt.figure(figsize=(8, 5)) plt.plot(x, y_sin, label="Sine", color="b") plt.plot(x, y_cos, label="Cosine", color="r")
plt.xlabel("Angle (radians)") plt.ylabel("Function value") plt.title("Sine and Cosine Functions") plt.legend()
plt.grid()
plt.show()
πΈ Output Preview

π― How to Run Install dependencies: pip install numpy matplotlib Run the script: python plot_sine_cosine.py
π Enhance the visualization! Try modifying colors, line styles, or adding annotations to make your plots even more insightful.
π Future Improvements πΉ Add interactive features using plotly πΉ Include additional trigonometric functions (e.g., tangent, cotangent) πΉ Save the plot as an image automatically πΉ Create an animated visualization of sine and cosine
π€ Contributing Want to improve this project? Feel free to fork the repository and submit a pull request!
Steps to Contribute: Fork this repository π΄ Clone your forked repo
git clone https://github.com/your-username/matplotlib_introduction.git cd sine-cosine-plot Create a new branch
git checkout -b feature-new-enhancement Make changes and commit
git add . git commit -m "Added a new feature" Push your branch and submit a pull request
git push origin feature-new-enhancement We appreciate every contribution! π
π License This project is open-source and available under the MIT License.
π© Contact π¬ Got questions or suggestions? Feel free to reach out:
- π§ Email: tunidev56@gmail.com
- π GitHub Profile: https://github.com/tuni56