Skip to content

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.

Notifications You must be signed in to change notification settings

tuni56/matplotlib_introduction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Š Visualizing Sine and Cosine with Matplotlib

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.

πŸ“– Table of Contents

  • πŸš€ 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

Define the range of values

x = np.linspace(0, 2 * np.pi, 100)

Compute sine and cosine values

y_sin = np.sin(x) y_cos = np.cos(x)

Create the plot

plt.figure(figsize=(8, 5)) plt.plot(x, y_sin, label="Sine", color="b") plt.plot(x, y_cos, label="Cosine", color="r")

Add labels, title, and legend

plt.xlabel("Angle (radians)") plt.ylabel("Function value") plt.title("Sine and Cosine Functions") plt.legend()

Show the plot

plt.grid() plt.show() πŸ“Έ Output Preview starting_matplotlib

🎯 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:

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages