From 976dc16400891e939bf18115e104ff8efd94cdfa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 27 Oct 2026 10:51:41 +0000 Subject: [PATCH 1/6] Initial plan From ebaef8fab54e32d6f3902774cf3ea9c4cff99cd0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 27 Oct 2026 10:53:19 +0000 Subject: [PATCH 2/6] Import matplotlib tutorial into Matplotlib-essentials Co-authored-by: NivedhGovil <290986888+NivedhGovil@users.noreply.github.com> --- Matplotlib-essentials/.gitignore | 218 ++++++++++++++++++ .../1_Basic_Line_Plot/README.md | 20 ++ .../1_Basic_Line_Plot/example.py | 18 ++ .../2_Markers_Line_Styles/README.md | 25 ++ .../2_Markers_Line_Styles/example.py | 26 +++ .../3_Titles_Labels_Ticks/README.md | 28 +++ .../3_Titles_Labels_Ticks/example.py | 32 +++ .../4_Multiple_Plots/README.md | 20 ++ .../4_Multiple_Plots/example.py | 19 ++ Matplotlib-essentials/5_Bar_Charts/README.md | 19 ++ Matplotlib-essentials/5_Bar_Charts/example.py | 20 ++ .../6_Scatter_Plots/README.md | 27 +++ .../6_Scatter_Plots/example.py | 33 +++ .../7_Tips_and_Further_Reading/README.md | 19 ++ .../7_Tips_and_Further_Reading/example.py | 40 ++++ Matplotlib-essentials/LICENSE | 21 ++ Matplotlib-essentials/README.md | 5 + 17 files changed, 590 insertions(+) create mode 100644 Matplotlib-essentials/.gitignore create mode 100644 Matplotlib-essentials/1_Basic_Line_Plot/README.md create mode 100644 Matplotlib-essentials/1_Basic_Line_Plot/example.py create mode 100644 Matplotlib-essentials/2_Markers_Line_Styles/README.md create mode 100644 Matplotlib-essentials/2_Markers_Line_Styles/example.py create mode 100644 Matplotlib-essentials/3_Titles_Labels_Ticks/README.md create mode 100644 Matplotlib-essentials/3_Titles_Labels_Ticks/example.py create mode 100644 Matplotlib-essentials/4_Multiple_Plots/README.md create mode 100644 Matplotlib-essentials/4_Multiple_Plots/example.py create mode 100644 Matplotlib-essentials/5_Bar_Charts/README.md create mode 100644 Matplotlib-essentials/5_Bar_Charts/example.py create mode 100644 Matplotlib-essentials/6_Scatter_Plots/README.md create mode 100644 Matplotlib-essentials/6_Scatter_Plots/example.py create mode 100644 Matplotlib-essentials/7_Tips_and_Further_Reading/README.md create mode 100644 Matplotlib-essentials/7_Tips_and_Further_Reading/example.py create mode 100644 Matplotlib-essentials/LICENSE create mode 100644 Matplotlib-essentials/README.md diff --git a/Matplotlib-essentials/.gitignore b/Matplotlib-essentials/.gitignore new file mode 100644 index 000000000..83972fadc --- /dev/null +++ b/Matplotlib-essentials/.gitignore @@ -0,0 +1,218 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[codz] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py.cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +# Pipfile.lock + +# UV +# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# uv.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +# poetry.lock +# poetry.toml + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python. +# https://pdm-project.org/en/latest/usage/project/#working-with-version-control +# pdm.lock +# pdm.toml +.pdm-python +.pdm-build/ + +# pixi +# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control. +# pixi.lock +# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one +# in the .venv directory. It is recommended not to include this directory in version control. +.pixi + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# Redis +*.rdb +*.aof +*.pid + +# RabbitMQ +mnesia/ +rabbitmq/ +rabbitmq-data/ + +# ActiveMQ +activemq-data/ + +# SageMath parsed files +*.sage.py + +# Environments +.env +.envrc +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +# .idea/ + +# Abstra +# Abstra is an AI-powered process automation framework. +# Ignore directories containing user credentials, local state, and settings. +# Learn more at https://abstra.io/docs +.abstra/ + +# Visual Studio Code +# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore +# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore +# and can be added to the global gitignore or merged into this file. However, if you prefer, +# you could uncomment the following to ignore the entire vscode folder +# .vscode/ +# Temporary file for partial code execution +tempCodeRunnerFile.py + +# Ruff stuff: +.ruff_cache/ + +# PyPI configuration file +.pypirc + +# Marimo +marimo/_static/ +marimo/_lsp/ +__marimo__/ + +# Streamlit +.streamlit/secrets.toml diff --git a/Matplotlib-essentials/1_Basic_Line_Plot/README.md b/Matplotlib-essentials/1_Basic_Line_Plot/README.md new file mode 100644 index 000000000..c21684a92 --- /dev/null +++ b/Matplotlib-essentials/1_Basic_Line_Plot/README.md @@ -0,0 +1,20 @@ +# Section 1 — Basic line plot + +This section introduces the most basic line plot in Matplotlib. The example shows how to plot y versus x and how Matplotlib uses default x-values when only y is provided. + +Example (see example.py in this folder for commented version): + +```python +import matplotlib.pyplot as plt +import numpy as np + +x = np.array([0, 6]) +y = np.array([10, 250]) + +plt.plot(x, y) +plt.show() +``` + +Notes: +- If you only pass y values to plt.plot, Matplotlib will assume x = [0, 1, 2, ...]. +- Use plt.show() to display the figure (in scripts or interactive sessions). \ No newline at end of file diff --git a/Matplotlib-essentials/1_Basic_Line_Plot/example.py b/Matplotlib-essentials/1_Basic_Line_Plot/example.py new file mode 100644 index 000000000..d7ce36a71 --- /dev/null +++ b/Matplotlib-essentials/1_Basic_Line_Plot/example.py @@ -0,0 +1,18 @@ +"""Section 1 — Basic line plot (example.py) + +This script demonstrates a minimal line plot and explains each step. +""" + +# Import matplotlib for plotting and numpy for numerical arrays +import matplotlib.pyplot as plt +import numpy as np + +# Define x and y data as NumPy arrays +x = np.array([0, 6]) # x coordinates for two points +y = np.array([10, 250]) # corresponding y coordinates + +# Plot y versus x as a line +plt.plot(x, y) # draws a line connecting (0,10) and (6,250) + +# Display the plot window (required to render the figure in scripts) +plt.show() \ No newline at end of file diff --git a/Matplotlib-essentials/2_Markers_Line_Styles/README.md b/Matplotlib-essentials/2_Markers_Line_Styles/README.md new file mode 100644 index 000000000..5cad96d04 --- /dev/null +++ b/Matplotlib-essentials/2_Markers_Line_Styles/README.md @@ -0,0 +1,25 @@ +# Section 2 — Markers, colors, and line styles + +This section covers markers (point symbols), line styles, and color customization. The example demonstrates several keyword arguments that control the plot's appearance. + +Example (see example.py in this folder for commented version): + +```python +import matplotlib.pyplot as plt +import numpy as np + +ypoints = np.array([3, 8, 1, 10]) + +# Basic marker +plt.plot(ypoints, marker='X') + +# Custom line style, marker face/edge colors, and line color +plt.plot(ypoints, linestyle='dotted', marker='d', markerfacecolor='red', markeredgecolor='green', color='blue') + +plt.show() +``` + +Common markers: 'o' (circle), '*' (star), '.' (point), 'x', 'X', '+', 's' (square), 'D' (diamond) +Line styles: '-' (solid), ':' (dotted), '--' (dashed), '-.' (dash-dot) + +You can also use a format shorthand like '*--y' (marker|line|color). \ No newline at end of file diff --git a/Matplotlib-essentials/2_Markers_Line_Styles/example.py b/Matplotlib-essentials/2_Markers_Line_Styles/example.py new file mode 100644 index 000000000..be10a6e65 --- /dev/null +++ b/Matplotlib-essentials/2_Markers_Line_Styles/example.py @@ -0,0 +1,26 @@ +"""Section 2 — Markers, colors, and line styles (example.py) + +This script shows how to change marker types, line styles, and colors. +Each significant parameter is commented. +""" + +import matplotlib.pyplot as plt +import numpy as np + +# Example data +ypoints = np.array([3, 8, 1, 10]) + +# Plot with a filled X marker at each data point +plt.plot(ypoints, marker='X') # marker='X' draws a large filled X on each point + +# Plot again (on the same axes) with more customization +plt.plot( + ypoints, + linestyle='dotted', # dotted line style + marker='d', # diamond marker for each data point + markerfacecolor='red', # fill color of the marker + markeredgecolor='green', # marker border color + color='blue' # line color +) + +plt.show() # render the figure \ No newline at end of file diff --git a/Matplotlib-essentials/3_Titles_Labels_Ticks/README.md b/Matplotlib-essentials/3_Titles_Labels_Ticks/README.md new file mode 100644 index 000000000..3d1b8bde8 --- /dev/null +++ b/Matplotlib-essentials/3_Titles_Labels_Ticks/README.md @@ -0,0 +1,28 @@ +# Section 3 — Titles, labels, and ticks + +This section explains how to add a title, axis labels, and control tick locations. It also shows plotting multiple series on the same axes. + +Example (see example.py in this folder for commented version): + +```python +import matplotlib.pyplot as plt +import numpy as np + +x = np.array([2023, 2024, 2025, 2026]) +y1 = np.array([15,25,30,20]) +y2 = np.array([17,23,38,5]) +y3 = np.array([13,15,20,30]) + +plt.title("Class size over the years", fontsize=20, family="serif", fontweight="bold") +plt.xlabel("Year", fontsize=15) +plt.ylabel("Class size", fontsize=15) + +plt.xticks(x) + +plt.plot(x, y1) +plt.plot(x, y2) +plt.plot(x, y3) +plt.show() +``` + +Use plt.xticks(...) to set tick locations explicitly. Titles and labels accept font size and family options. \ No newline at end of file diff --git a/Matplotlib-essentials/3_Titles_Labels_Ticks/example.py b/Matplotlib-essentials/3_Titles_Labels_Ticks/example.py new file mode 100644 index 000000000..6936d4b2a --- /dev/null +++ b/Matplotlib-essentials/3_Titles_Labels_Ticks/example.py @@ -0,0 +1,32 @@ +"""Section 3 — Titles, labels, and ticks (example.py) + +This script shows how to set a plot title, axis labels, explicit x ticks, and how to plot multiple series. +Each line includes a comment explaining its purpose. +""" + +import matplotlib.pyplot as plt +import numpy as np + +# X values represent years and y values are three different class-size series +x = np.array([2023, 2024, 2025, 2026]) +y1 = np.array([15, 25, 30, 20]) +y2 = np.array([17, 23, 38, 5]) +y3 = np.array([13, 15, 20, 30]) + +# Add a title with font customizations +plt.title("Class size over the years", fontsize=20, family="serif", fontweight="bold") + +# Add axis labels +plt.xlabel("Year", fontsize=15) +plt.ylabel("Class size", fontsize=15) + +# Set x-axis tick locations to the years in x +plt.xticks(x) + +# Plot three lines on the same axes +plt.plot(x, y1) # first series +plt.plot(x, y2) # second series +plt.plot(x, y3) # third series + +# Render the figure +plt.show() \ No newline at end of file diff --git a/Matplotlib-essentials/4_Multiple_Plots/README.md b/Matplotlib-essentials/4_Multiple_Plots/README.md new file mode 100644 index 000000000..e5ae461b5 --- /dev/null +++ b/Matplotlib-essentials/4_Multiple_Plots/README.md @@ -0,0 +1,20 @@ +# Section 4 — Multiple plots and the format shorthand + +This short section illustrates the format shorthand (marker|line|color) and shows multiple lines together. Use the shorthand to combine marker, line style, and color in one string. + +Example (see example.py for commented version): + +```python +import matplotlib.pyplot as plt +import numpy as np + +x = np.array([0, 1, 2, 3, 4]) +y1 = np.array([1, 4, 9, 16, 25]) +y2 = np.array([1, 2, 3, 4, 5]) + +plt.plot(x, y1, '*--y') # star markers, dashed line, yellow color +plt.plot(x, y2, 'o-') # circle markers, solid line, default color +plt.show() +``` + +When plotting many subplots use plt.subplots() or figure/axes API for fine control. \ No newline at end of file diff --git a/Matplotlib-essentials/4_Multiple_Plots/example.py b/Matplotlib-essentials/4_Multiple_Plots/example.py new file mode 100644 index 000000000..103ee383c --- /dev/null +++ b/Matplotlib-essentials/4_Multiple_Plots/example.py @@ -0,0 +1,19 @@ +"""Section 4 — Multiple plots and the format shorthand (example.py) + +This example shows using the fmt shorthand to set marker, line style, and color concisely, +and how to plot multiple series on the same axes. +""" + +import matplotlib.pyplot as plt +import numpy as np + +# Simple x and two y-series +x = np.array([0, 1, 2, 3, 4]) +y1 = np.array([1, 4, 9, 16, 25]) +y2 = np.array([1, 2, 3, 4, 5]) + +# fmt shorthand: marker|line|color +plt.plot(x, y1, '*--y') # star markers, dashed line, yellow color +plt.plot(x, y2, 'o-') # circle markers, solid line + +plt.show() \ No newline at end of file diff --git a/Matplotlib-essentials/5_Bar_Charts/README.md b/Matplotlib-essentials/5_Bar_Charts/README.md new file mode 100644 index 000000000..d61c902f6 --- /dev/null +++ b/Matplotlib-essentials/5_Bar_Charts/README.md @@ -0,0 +1,19 @@ +# Section 5 — Bar charts + +This section shows how to create vertical bar charts and set figure size. For horizontal bars use plt.barh(...). + +Example (see example.py in this folder for commented version): + +```python +import numpy as np +import matplotlib.pyplot as plt + +categories = np.array(["Grains", "Fruit", "Vegetables", "Protein", "Dairy"]) +values = np.array([4, 3, 2, 5, 3]) + +plt.figure(figsize=(7,5)) +plt.bar(categories, values, color="#a87132") +plt.show() +``` + +Bar charts are useful to compare categorical data side-by-side. \ No newline at end of file diff --git a/Matplotlib-essentials/5_Bar_Charts/example.py b/Matplotlib-essentials/5_Bar_Charts/example.py new file mode 100644 index 000000000..ed14b9f78 --- /dev/null +++ b/Matplotlib-essentials/5_Bar_Charts/example.py @@ -0,0 +1,20 @@ +"""Section 5 — Bar charts (example.py) + +Creates a simple vertical bar chart and explains figure sizing and color choices. +""" + +import numpy as np +import matplotlib.pyplot as plt + +# Categories (x-axis) and their corresponding numeric values (heights) +categories = np.array(["Grains", "Fruit", "Vegetables", "Protein", "Dairy"]) +values = np.array([4, 3, 2, 5, 3]) + +# Set the figure size in inches (width, height) +plt.figure(figsize=(7, 5)) + +# Draw a vertical bar chart; color can be any Matplotlib color spec +plt.bar(categories, values, color="#a87132") + +# Display the plot +plt.show() \ No newline at end of file diff --git a/Matplotlib-essentials/6_Scatter_Plots/README.md b/Matplotlib-essentials/6_Scatter_Plots/README.md new file mode 100644 index 000000000..134644361 --- /dev/null +++ b/Matplotlib-essentials/6_Scatter_Plots/README.md @@ -0,0 +1,27 @@ +# Section 6 — Scatter plots and annotations + +This section covers scatter plots (point clouds), adding horizontal lines, legends, and labels. + +Example (see example.py in this folder for a commented version): + +```python +import numpy as np +import matplotlib.pyplot as plt + +x1 = [0,1,1,2,3,4,5,6,7,7,8] +y1 = [55,60,65,62,68,70,75,78,82,85,87] + +x2 = np.array([0,1,2,2,3,4,5,6,7,8,8]) +y2 = np.array([50,58,65,70,72,78,83,88,92,95,97]) + +plt.scatter(x1, y1, s=50, color="#d11d59", label="Class A") +plt.scatter(x2, y2, s=50, color="#6ba867", label="Class B") + +plt.xlabel("Hours studied") +plt.ylabel("Test Scores") +plt.axhline(y=85, color="#4287f5", linestyle="--", label="Marks to get A grade") +plt.legend() +plt.show() +``` + +Use plt.legend() to show labels provided to plotting calls. \ No newline at end of file diff --git a/Matplotlib-essentials/6_Scatter_Plots/example.py b/Matplotlib-essentials/6_Scatter_Plots/example.py new file mode 100644 index 000000000..a82f55327 --- /dev/null +++ b/Matplotlib-essentials/6_Scatter_Plots/example.py @@ -0,0 +1,33 @@ +"""Section 6 — Scatter plots and annotations (example.py) + +Creates two scatter series, adds labels, a guide line, and a legend. +Comments explain each parameter. +""" + +import numpy as np +import matplotlib.pyplot as plt + +# Class A data (lists work fine for scatter) +x1 = [0, 1, 1, 2, 3, 4, 5, 6, 7, 7, 8] +y1 = [55, 60, 65, 62, 68, 70, 75, 78, 82, 85, 87] + +# Class B data as NumPy arrays +x2 = np.array([0, 1, 2, 2, 3, 4, 5, 6, 7, 8, 8]) +y2 = np.array([50, 58, 65, 70, 72, 78, 83, 88, 92, 95, 97]) + +# Scatter plots: s controls marker size, color is a color string/hex, label used by legend +plt.scatter(x1, y1, s=50, color="#d11d59", label="Class A") +plt.scatter(x2, y2, s=50, color="#6ba867", label="Class B") + +# Axis labels +plt.xlabel("Hours studied") +plt.ylabel("Test Scores") + +# Draw a horizontal reference line at y=85 (e.g., threshold for grade A) +plt.axhline(y=85, color="#4287f5", linestyle="--", label="Marks to get A grade") + +# Show legend to identify each series +plt.legend() + +# Render the figure +plt.show() \ No newline at end of file diff --git a/Matplotlib-essentials/7_Tips_and_Further_Reading/README.md b/Matplotlib-essentials/7_Tips_and_Further_Reading/README.md new file mode 100644 index 000000000..ff8a714d0 --- /dev/null +++ b/Matplotlib-essentials/7_Tips_and_Further_Reading/README.md @@ -0,0 +1,19 @@ +# Section 7 — Tips and further reading + +This final section provides common tips for saving figures, adjusting figure size, and using subplots. It also links to the official Matplotlib documentation. + +Example tips (see example.py in this folder for commented usage): + +```python +# Save figure to disk with high DPI and tight layout +plt.savefig("figure.png", dpi=300, bbox_inches="tight") + +# Create a figure with multiple subplots +fig, axes = plt.subplots(2, 2, figsize=(10, 8)) + +# Use the gallery and docs for more advanced topics: https://matplotlib.org +``` + +Further reading: +- Matplotlib official documentation: https://matplotlib.org +- Matplotlib gallery for examples and inspiration. \ No newline at end of file diff --git a/Matplotlib-essentials/7_Tips_and_Further_Reading/example.py b/Matplotlib-essentials/7_Tips_and_Further_Reading/example.py new file mode 100644 index 000000000..ff3dbd2eb --- /dev/null +++ b/Matplotlib-essentials/7_Tips_and_Further_Reading/example.py @@ -0,0 +1,40 @@ +"""Section 7 — Tips and further reading (example.py) + +Helpful snippets for saving figures, adjusting figure size, and using subplots. +""" + +import matplotlib.pyplot as plt +import numpy as np + +# Example: create a simple plot and save it to disk +x = np.linspace(0, 2 * np.pi, 100) +y = np.sin(x) +plt.plot(x, y) + +# Save the current figure to a PNG file with 300 DPI and tight bounding box +plt.savefig("sine_plot.png", dpi=300, bbox_inches="tight") + +# Close the figure if running multiple scripts to avoid overlapping figures +plt.close() + +# Example: create a 2x2 grid of subplots for multiple related plots +fig, axes = plt.subplots(2, 2, figsize=(10, 8)) + +# axes is a 2x2 NumPy array of Axes objects; we can fill them individually +axes[0, 0].plot(x, np.sin(x)) +axes[0, 0].set_title("sin(x)") + +axes[0, 1].plot(x, np.cos(x), "r") +axes[0, 1].set_title("cos(x)") + +axes[1, 0].plot(x, np.tan(x), ".") +axes[1, 0].set_title("tan(x)") + +axes[1, 1].plot(x, np.sin(2 * x), "g--") +axes[1, 1].set_title("sin(2x)") + +# Tight layout makes sure titles/labels don't overlap +fig.tight_layout() + +# Show the figure with all subplots +plt.show() \ No newline at end of file diff --git a/Matplotlib-essentials/LICENSE b/Matplotlib-essentials/LICENSE new file mode 100644 index 000000000..6cbb21e69 --- /dev/null +++ b/Matplotlib-essentials/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 NivedhGovil + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Matplotlib-essentials/README.md b/Matplotlib-essentials/README.md new file mode 100644 index 000000000..ec72b3d2c --- /dev/null +++ b/Matplotlib-essentials/README.md @@ -0,0 +1,5 @@ +# An-introduction-to-matplotlib-in-python + +This is a crash-course on Python's library: Matplotlib. + +Go thorugh each module (1 - 7) and once you are ready, you can follow the Project tutorial. From 7abaa640faf7af338a598e30262dba69b2a66a3c Mon Sep 17 00:00:00 2001 From: Nivedh Govil Date: Tue, 27 Oct 2026 16:32:42 +0530 Subject: [PATCH 3/6] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b5906c7ef..c5282b9ef 100644 --- a/README.md +++ b/README.md @@ -418,7 +418,7 @@ To get started, simply fork this repo. Please refer to [CONTRIBUTING.md](CONTRIB - [Part 4: Predicting Stock Prices](https://www.youtube.com/watch?v=SSu00IRRraY&index=4&list=PL2-dafEMk2A6QKz1mrk1uIGfHkC1zZ6UU) - [Part 5: Deep Dream in TensorFlow](https://www.youtube.com/watch?v=MrBzgvUNr4w&list=PL2-dafEMk2A6QKz1mrk1uIGfHkC1zZ6UU&index=5) - [Part 6: Genetic Algorithms](https://www.youtube.com/watch?v=dSofAXnnFrY&index=6&list=PL2-dafEMk2A6QKz1mrk1uIGfHkC1zZ6UU) - +- [Build a python script to fetch daily temperature readings and run statistics on it]([https://github.com/NivedhGovil/An-introduction-to-matplotlib](https://github.com/NivedhGovil/Matplotlib-guide-and-weather-project)) ### Machine Learning: - [Write Linear Regression From Scratch in Python](https://www.youtube.com/watch?v=uwwWVAgJBcM) (video) @@ -508,7 +508,7 @@ To get started, simply fork this repo. Please refer to [CONTRIBUTING.md](CONTRIB ### Miscellaneous: -- [Build a Simple Interpreter](https://ruslanspivak.com/lsbasi-part1/) +- [Build a Simple Interpreter](https://ruslanspivak.com/lsbasi-part1/) - [Build a Simple Blockchain in Python](https://hackernoon.com/learn-blockchains-by-building-one-117428612f46) - [Building a Gas Pump Scanner with OpenCV/Python/iOS](https://hackernoon.com/building-a-gas-pump-scanner-with-opencv-python-ios-116fe6c9ae8b) - [Build a Distributed Streaming System with Python and Kafka](https://codequs.com/p/S14jQ5UyG/build-a-distributed-streaming-system-with-apache-kafka-and-python) From d0f7703c3e29a1b83566fcfeb5588ab98bcbea90 Mon Sep 17 00:00:00 2001 From: Nivedh Govil Date: Tue, 27 Oct 2026 16:33:33 +0530 Subject: [PATCH 4/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c5282b9ef..86910e0cc 100644 --- a/README.md +++ b/README.md @@ -418,7 +418,7 @@ To get started, simply fork this repo. Please refer to [CONTRIBUTING.md](CONTRIB - [Part 4: Predicting Stock Prices](https://www.youtube.com/watch?v=SSu00IRRraY&index=4&list=PL2-dafEMk2A6QKz1mrk1uIGfHkC1zZ6UU) - [Part 5: Deep Dream in TensorFlow](https://www.youtube.com/watch?v=MrBzgvUNr4w&list=PL2-dafEMk2A6QKz1mrk1uIGfHkC1zZ6UU&index=5) - [Part 6: Genetic Algorithms](https://www.youtube.com/watch?v=dSofAXnnFrY&index=6&list=PL2-dafEMk2A6QKz1mrk1uIGfHkC1zZ6UU) -- [Build a python script to fetch daily temperature readings and run statistics on it]([https://github.com/NivedhGovil/An-introduction-to-matplotlib](https://github.com/NivedhGovil/Matplotlib-guide-and-weather-project)) +- [Build a python script to fetch daily temperature readings and run statistics on it](https://github.com/NivedhGovil/Matplotlib-guide-and-weather-project) ### Machine Learning: - [Write Linear Regression From Scratch in Python](https://www.youtube.com/watch?v=uwwWVAgJBcM) (video) From 424e501a1c72a8bd6efa94839c8c9ae17686b1f3 Mon Sep 17 00:00:00 2001 From: Nivedh Govil Date: Fri, 20 Nov 2026 15:45:01 +0530 Subject: [PATCH 5/6] Delete Matplotlib-essentials directory --- Matplotlib-essentials/.gitignore | 218 ------------------ .../1_Basic_Line_Plot/README.md | 20 -- .../1_Basic_Line_Plot/example.py | 18 -- .../2_Markers_Line_Styles/README.md | 25 -- .../2_Markers_Line_Styles/example.py | 26 --- .../3_Titles_Labels_Ticks/README.md | 28 --- .../3_Titles_Labels_Ticks/example.py | 32 --- .../4_Multiple_Plots/README.md | 20 -- .../4_Multiple_Plots/example.py | 19 -- Matplotlib-essentials/5_Bar_Charts/README.md | 19 -- Matplotlib-essentials/5_Bar_Charts/example.py | 20 -- .../6_Scatter_Plots/README.md | 27 --- .../6_Scatter_Plots/example.py | 33 --- .../7_Tips_and_Further_Reading/README.md | 19 -- .../7_Tips_and_Further_Reading/example.py | 40 ---- Matplotlib-essentials/LICENSE | 21 -- Matplotlib-essentials/README.md | 5 - 17 files changed, 590 deletions(-) delete mode 100644 Matplotlib-essentials/.gitignore delete mode 100644 Matplotlib-essentials/1_Basic_Line_Plot/README.md delete mode 100644 Matplotlib-essentials/1_Basic_Line_Plot/example.py delete mode 100644 Matplotlib-essentials/2_Markers_Line_Styles/README.md delete mode 100644 Matplotlib-essentials/2_Markers_Line_Styles/example.py delete mode 100644 Matplotlib-essentials/3_Titles_Labels_Ticks/README.md delete mode 100644 Matplotlib-essentials/3_Titles_Labels_Ticks/example.py delete mode 100644 Matplotlib-essentials/4_Multiple_Plots/README.md delete mode 100644 Matplotlib-essentials/4_Multiple_Plots/example.py delete mode 100644 Matplotlib-essentials/5_Bar_Charts/README.md delete mode 100644 Matplotlib-essentials/5_Bar_Charts/example.py delete mode 100644 Matplotlib-essentials/6_Scatter_Plots/README.md delete mode 100644 Matplotlib-essentials/6_Scatter_Plots/example.py delete mode 100644 Matplotlib-essentials/7_Tips_and_Further_Reading/README.md delete mode 100644 Matplotlib-essentials/7_Tips_and_Further_Reading/example.py delete mode 100644 Matplotlib-essentials/LICENSE delete mode 100644 Matplotlib-essentials/README.md diff --git a/Matplotlib-essentials/.gitignore b/Matplotlib-essentials/.gitignore deleted file mode 100644 index 83972fadc..000000000 --- a/Matplotlib-essentials/.gitignore +++ /dev/null @@ -1,218 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[codz] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py.cover -.hypothesis/ -.pytest_cache/ -cover/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -.pybuilder/ -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -# Pipfile.lock - -# UV -# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# uv.lock - -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -# poetry.lock -# poetry.toml - -# pdm -# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. -# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python. -# https://pdm-project.org/en/latest/usage/project/#working-with-version-control -# pdm.lock -# pdm.toml -.pdm-python -.pdm-build/ - -# pixi -# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control. -# pixi.lock -# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one -# in the .venv directory. It is recommended not to include this directory in version control. -.pixi - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# Redis -*.rdb -*.aof -*.pid - -# RabbitMQ -mnesia/ -rabbitmq/ -rabbitmq-data/ - -# ActiveMQ -activemq-data/ - -# SageMath parsed files -*.sage.py - -# Environments -.env -.envrc -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# pytype static type analyzer -.pytype/ - -# Cython debug symbols -cython_debug/ - -# PyCharm -# JetBrains specific template is maintained in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -# .idea/ - -# Abstra -# Abstra is an AI-powered process automation framework. -# Ignore directories containing user credentials, local state, and settings. -# Learn more at https://abstra.io/docs -.abstra/ - -# Visual Studio Code -# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore -# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore -# and can be added to the global gitignore or merged into this file. However, if you prefer, -# you could uncomment the following to ignore the entire vscode folder -# .vscode/ -# Temporary file for partial code execution -tempCodeRunnerFile.py - -# Ruff stuff: -.ruff_cache/ - -# PyPI configuration file -.pypirc - -# Marimo -marimo/_static/ -marimo/_lsp/ -__marimo__/ - -# Streamlit -.streamlit/secrets.toml diff --git a/Matplotlib-essentials/1_Basic_Line_Plot/README.md b/Matplotlib-essentials/1_Basic_Line_Plot/README.md deleted file mode 100644 index c21684a92..000000000 --- a/Matplotlib-essentials/1_Basic_Line_Plot/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# Section 1 — Basic line plot - -This section introduces the most basic line plot in Matplotlib. The example shows how to plot y versus x and how Matplotlib uses default x-values when only y is provided. - -Example (see example.py in this folder for commented version): - -```python -import matplotlib.pyplot as plt -import numpy as np - -x = np.array([0, 6]) -y = np.array([10, 250]) - -plt.plot(x, y) -plt.show() -``` - -Notes: -- If you only pass y values to plt.plot, Matplotlib will assume x = [0, 1, 2, ...]. -- Use plt.show() to display the figure (in scripts or interactive sessions). \ No newline at end of file diff --git a/Matplotlib-essentials/1_Basic_Line_Plot/example.py b/Matplotlib-essentials/1_Basic_Line_Plot/example.py deleted file mode 100644 index d7ce36a71..000000000 --- a/Matplotlib-essentials/1_Basic_Line_Plot/example.py +++ /dev/null @@ -1,18 +0,0 @@ -"""Section 1 — Basic line plot (example.py) - -This script demonstrates a minimal line plot and explains each step. -""" - -# Import matplotlib for plotting and numpy for numerical arrays -import matplotlib.pyplot as plt -import numpy as np - -# Define x and y data as NumPy arrays -x = np.array([0, 6]) # x coordinates for two points -y = np.array([10, 250]) # corresponding y coordinates - -# Plot y versus x as a line -plt.plot(x, y) # draws a line connecting (0,10) and (6,250) - -# Display the plot window (required to render the figure in scripts) -plt.show() \ No newline at end of file diff --git a/Matplotlib-essentials/2_Markers_Line_Styles/README.md b/Matplotlib-essentials/2_Markers_Line_Styles/README.md deleted file mode 100644 index 5cad96d04..000000000 --- a/Matplotlib-essentials/2_Markers_Line_Styles/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Section 2 — Markers, colors, and line styles - -This section covers markers (point symbols), line styles, and color customization. The example demonstrates several keyword arguments that control the plot's appearance. - -Example (see example.py in this folder for commented version): - -```python -import matplotlib.pyplot as plt -import numpy as np - -ypoints = np.array([3, 8, 1, 10]) - -# Basic marker -plt.plot(ypoints, marker='X') - -# Custom line style, marker face/edge colors, and line color -plt.plot(ypoints, linestyle='dotted', marker='d', markerfacecolor='red', markeredgecolor='green', color='blue') - -plt.show() -``` - -Common markers: 'o' (circle), '*' (star), '.' (point), 'x', 'X', '+', 's' (square), 'D' (diamond) -Line styles: '-' (solid), ':' (dotted), '--' (dashed), '-.' (dash-dot) - -You can also use a format shorthand like '*--y' (marker|line|color). \ No newline at end of file diff --git a/Matplotlib-essentials/2_Markers_Line_Styles/example.py b/Matplotlib-essentials/2_Markers_Line_Styles/example.py deleted file mode 100644 index be10a6e65..000000000 --- a/Matplotlib-essentials/2_Markers_Line_Styles/example.py +++ /dev/null @@ -1,26 +0,0 @@ -"""Section 2 — Markers, colors, and line styles (example.py) - -This script shows how to change marker types, line styles, and colors. -Each significant parameter is commented. -""" - -import matplotlib.pyplot as plt -import numpy as np - -# Example data -ypoints = np.array([3, 8, 1, 10]) - -# Plot with a filled X marker at each data point -plt.plot(ypoints, marker='X') # marker='X' draws a large filled X on each point - -# Plot again (on the same axes) with more customization -plt.plot( - ypoints, - linestyle='dotted', # dotted line style - marker='d', # diamond marker for each data point - markerfacecolor='red', # fill color of the marker - markeredgecolor='green', # marker border color - color='blue' # line color -) - -plt.show() # render the figure \ No newline at end of file diff --git a/Matplotlib-essentials/3_Titles_Labels_Ticks/README.md b/Matplotlib-essentials/3_Titles_Labels_Ticks/README.md deleted file mode 100644 index 3d1b8bde8..000000000 --- a/Matplotlib-essentials/3_Titles_Labels_Ticks/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# Section 3 — Titles, labels, and ticks - -This section explains how to add a title, axis labels, and control tick locations. It also shows plotting multiple series on the same axes. - -Example (see example.py in this folder for commented version): - -```python -import matplotlib.pyplot as plt -import numpy as np - -x = np.array([2023, 2024, 2025, 2026]) -y1 = np.array([15,25,30,20]) -y2 = np.array([17,23,38,5]) -y3 = np.array([13,15,20,30]) - -plt.title("Class size over the years", fontsize=20, family="serif", fontweight="bold") -plt.xlabel("Year", fontsize=15) -plt.ylabel("Class size", fontsize=15) - -plt.xticks(x) - -plt.plot(x, y1) -plt.plot(x, y2) -plt.plot(x, y3) -plt.show() -``` - -Use plt.xticks(...) to set tick locations explicitly. Titles and labels accept font size and family options. \ No newline at end of file diff --git a/Matplotlib-essentials/3_Titles_Labels_Ticks/example.py b/Matplotlib-essentials/3_Titles_Labels_Ticks/example.py deleted file mode 100644 index 6936d4b2a..000000000 --- a/Matplotlib-essentials/3_Titles_Labels_Ticks/example.py +++ /dev/null @@ -1,32 +0,0 @@ -"""Section 3 — Titles, labels, and ticks (example.py) - -This script shows how to set a plot title, axis labels, explicit x ticks, and how to plot multiple series. -Each line includes a comment explaining its purpose. -""" - -import matplotlib.pyplot as plt -import numpy as np - -# X values represent years and y values are three different class-size series -x = np.array([2023, 2024, 2025, 2026]) -y1 = np.array([15, 25, 30, 20]) -y2 = np.array([17, 23, 38, 5]) -y3 = np.array([13, 15, 20, 30]) - -# Add a title with font customizations -plt.title("Class size over the years", fontsize=20, family="serif", fontweight="bold") - -# Add axis labels -plt.xlabel("Year", fontsize=15) -plt.ylabel("Class size", fontsize=15) - -# Set x-axis tick locations to the years in x -plt.xticks(x) - -# Plot three lines on the same axes -plt.plot(x, y1) # first series -plt.plot(x, y2) # second series -plt.plot(x, y3) # third series - -# Render the figure -plt.show() \ No newline at end of file diff --git a/Matplotlib-essentials/4_Multiple_Plots/README.md b/Matplotlib-essentials/4_Multiple_Plots/README.md deleted file mode 100644 index e5ae461b5..000000000 --- a/Matplotlib-essentials/4_Multiple_Plots/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# Section 4 — Multiple plots and the format shorthand - -This short section illustrates the format shorthand (marker|line|color) and shows multiple lines together. Use the shorthand to combine marker, line style, and color in one string. - -Example (see example.py for commented version): - -```python -import matplotlib.pyplot as plt -import numpy as np - -x = np.array([0, 1, 2, 3, 4]) -y1 = np.array([1, 4, 9, 16, 25]) -y2 = np.array([1, 2, 3, 4, 5]) - -plt.plot(x, y1, '*--y') # star markers, dashed line, yellow color -plt.plot(x, y2, 'o-') # circle markers, solid line, default color -plt.show() -``` - -When plotting many subplots use plt.subplots() or figure/axes API for fine control. \ No newline at end of file diff --git a/Matplotlib-essentials/4_Multiple_Plots/example.py b/Matplotlib-essentials/4_Multiple_Plots/example.py deleted file mode 100644 index 103ee383c..000000000 --- a/Matplotlib-essentials/4_Multiple_Plots/example.py +++ /dev/null @@ -1,19 +0,0 @@ -"""Section 4 — Multiple plots and the format shorthand (example.py) - -This example shows using the fmt shorthand to set marker, line style, and color concisely, -and how to plot multiple series on the same axes. -""" - -import matplotlib.pyplot as plt -import numpy as np - -# Simple x and two y-series -x = np.array([0, 1, 2, 3, 4]) -y1 = np.array([1, 4, 9, 16, 25]) -y2 = np.array([1, 2, 3, 4, 5]) - -# fmt shorthand: marker|line|color -plt.plot(x, y1, '*--y') # star markers, dashed line, yellow color -plt.plot(x, y2, 'o-') # circle markers, solid line - -plt.show() \ No newline at end of file diff --git a/Matplotlib-essentials/5_Bar_Charts/README.md b/Matplotlib-essentials/5_Bar_Charts/README.md deleted file mode 100644 index d61c902f6..000000000 --- a/Matplotlib-essentials/5_Bar_Charts/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# Section 5 — Bar charts - -This section shows how to create vertical bar charts and set figure size. For horizontal bars use plt.barh(...). - -Example (see example.py in this folder for commented version): - -```python -import numpy as np -import matplotlib.pyplot as plt - -categories = np.array(["Grains", "Fruit", "Vegetables", "Protein", "Dairy"]) -values = np.array([4, 3, 2, 5, 3]) - -plt.figure(figsize=(7,5)) -plt.bar(categories, values, color="#a87132") -plt.show() -``` - -Bar charts are useful to compare categorical data side-by-side. \ No newline at end of file diff --git a/Matplotlib-essentials/5_Bar_Charts/example.py b/Matplotlib-essentials/5_Bar_Charts/example.py deleted file mode 100644 index ed14b9f78..000000000 --- a/Matplotlib-essentials/5_Bar_Charts/example.py +++ /dev/null @@ -1,20 +0,0 @@ -"""Section 5 — Bar charts (example.py) - -Creates a simple vertical bar chart and explains figure sizing and color choices. -""" - -import numpy as np -import matplotlib.pyplot as plt - -# Categories (x-axis) and their corresponding numeric values (heights) -categories = np.array(["Grains", "Fruit", "Vegetables", "Protein", "Dairy"]) -values = np.array([4, 3, 2, 5, 3]) - -# Set the figure size in inches (width, height) -plt.figure(figsize=(7, 5)) - -# Draw a vertical bar chart; color can be any Matplotlib color spec -plt.bar(categories, values, color="#a87132") - -# Display the plot -plt.show() \ No newline at end of file diff --git a/Matplotlib-essentials/6_Scatter_Plots/README.md b/Matplotlib-essentials/6_Scatter_Plots/README.md deleted file mode 100644 index 134644361..000000000 --- a/Matplotlib-essentials/6_Scatter_Plots/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# Section 6 — Scatter plots and annotations - -This section covers scatter plots (point clouds), adding horizontal lines, legends, and labels. - -Example (see example.py in this folder for a commented version): - -```python -import numpy as np -import matplotlib.pyplot as plt - -x1 = [0,1,1,2,3,4,5,6,7,7,8] -y1 = [55,60,65,62,68,70,75,78,82,85,87] - -x2 = np.array([0,1,2,2,3,4,5,6,7,8,8]) -y2 = np.array([50,58,65,70,72,78,83,88,92,95,97]) - -plt.scatter(x1, y1, s=50, color="#d11d59", label="Class A") -plt.scatter(x2, y2, s=50, color="#6ba867", label="Class B") - -plt.xlabel("Hours studied") -plt.ylabel("Test Scores") -plt.axhline(y=85, color="#4287f5", linestyle="--", label="Marks to get A grade") -plt.legend() -plt.show() -``` - -Use plt.legend() to show labels provided to plotting calls. \ No newline at end of file diff --git a/Matplotlib-essentials/6_Scatter_Plots/example.py b/Matplotlib-essentials/6_Scatter_Plots/example.py deleted file mode 100644 index a82f55327..000000000 --- a/Matplotlib-essentials/6_Scatter_Plots/example.py +++ /dev/null @@ -1,33 +0,0 @@ -"""Section 6 — Scatter plots and annotations (example.py) - -Creates two scatter series, adds labels, a guide line, and a legend. -Comments explain each parameter. -""" - -import numpy as np -import matplotlib.pyplot as plt - -# Class A data (lists work fine for scatter) -x1 = [0, 1, 1, 2, 3, 4, 5, 6, 7, 7, 8] -y1 = [55, 60, 65, 62, 68, 70, 75, 78, 82, 85, 87] - -# Class B data as NumPy arrays -x2 = np.array([0, 1, 2, 2, 3, 4, 5, 6, 7, 8, 8]) -y2 = np.array([50, 58, 65, 70, 72, 78, 83, 88, 92, 95, 97]) - -# Scatter plots: s controls marker size, color is a color string/hex, label used by legend -plt.scatter(x1, y1, s=50, color="#d11d59", label="Class A") -plt.scatter(x2, y2, s=50, color="#6ba867", label="Class B") - -# Axis labels -plt.xlabel("Hours studied") -plt.ylabel("Test Scores") - -# Draw a horizontal reference line at y=85 (e.g., threshold for grade A) -plt.axhline(y=85, color="#4287f5", linestyle="--", label="Marks to get A grade") - -# Show legend to identify each series -plt.legend() - -# Render the figure -plt.show() \ No newline at end of file diff --git a/Matplotlib-essentials/7_Tips_and_Further_Reading/README.md b/Matplotlib-essentials/7_Tips_and_Further_Reading/README.md deleted file mode 100644 index ff8a714d0..000000000 --- a/Matplotlib-essentials/7_Tips_and_Further_Reading/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# Section 7 — Tips and further reading - -This final section provides common tips for saving figures, adjusting figure size, and using subplots. It also links to the official Matplotlib documentation. - -Example tips (see example.py in this folder for commented usage): - -```python -# Save figure to disk with high DPI and tight layout -plt.savefig("figure.png", dpi=300, bbox_inches="tight") - -# Create a figure with multiple subplots -fig, axes = plt.subplots(2, 2, figsize=(10, 8)) - -# Use the gallery and docs for more advanced topics: https://matplotlib.org -``` - -Further reading: -- Matplotlib official documentation: https://matplotlib.org -- Matplotlib gallery for examples and inspiration. \ No newline at end of file diff --git a/Matplotlib-essentials/7_Tips_and_Further_Reading/example.py b/Matplotlib-essentials/7_Tips_and_Further_Reading/example.py deleted file mode 100644 index ff3dbd2eb..000000000 --- a/Matplotlib-essentials/7_Tips_and_Further_Reading/example.py +++ /dev/null @@ -1,40 +0,0 @@ -"""Section 7 — Tips and further reading (example.py) - -Helpful snippets for saving figures, adjusting figure size, and using subplots. -""" - -import matplotlib.pyplot as plt -import numpy as np - -# Example: create a simple plot and save it to disk -x = np.linspace(0, 2 * np.pi, 100) -y = np.sin(x) -plt.plot(x, y) - -# Save the current figure to a PNG file with 300 DPI and tight bounding box -plt.savefig("sine_plot.png", dpi=300, bbox_inches="tight") - -# Close the figure if running multiple scripts to avoid overlapping figures -plt.close() - -# Example: create a 2x2 grid of subplots for multiple related plots -fig, axes = plt.subplots(2, 2, figsize=(10, 8)) - -# axes is a 2x2 NumPy array of Axes objects; we can fill them individually -axes[0, 0].plot(x, np.sin(x)) -axes[0, 0].set_title("sin(x)") - -axes[0, 1].plot(x, np.cos(x), "r") -axes[0, 1].set_title("cos(x)") - -axes[1, 0].plot(x, np.tan(x), ".") -axes[1, 0].set_title("tan(x)") - -axes[1, 1].plot(x, np.sin(2 * x), "g--") -axes[1, 1].set_title("sin(2x)") - -# Tight layout makes sure titles/labels don't overlap -fig.tight_layout() - -# Show the figure with all subplots -plt.show() \ No newline at end of file diff --git a/Matplotlib-essentials/LICENSE b/Matplotlib-essentials/LICENSE deleted file mode 100644 index 6cbb21e69..000000000 --- a/Matplotlib-essentials/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2026 NivedhGovil - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Matplotlib-essentials/README.md b/Matplotlib-essentials/README.md deleted file mode 100644 index ec72b3d2c..000000000 --- a/Matplotlib-essentials/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# An-introduction-to-matplotlib-in-python - -This is a crash-course on Python's library: Matplotlib. - -Go thorugh each module (1 - 7) and once you are ready, you can follow the Project tutorial. From 6de7f6a5ecd96819003b27f92262588f2590c3a7 Mon Sep 17 00:00:00 2001 From: Nivedh Govil Date: Fri, 20 Nov 2026 15:46:27 +0530 Subject: [PATCH 6/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 86910e0cc..e177dd7a6 100644 --- a/README.md +++ b/README.md @@ -418,7 +418,7 @@ To get started, simply fork this repo. Please refer to [CONTRIBUTING.md](CONTRIB - [Part 4: Predicting Stock Prices](https://www.youtube.com/watch?v=SSu00IRRraY&index=4&list=PL2-dafEMk2A6QKz1mrk1uIGfHkC1zZ6UU) - [Part 5: Deep Dream in TensorFlow](https://www.youtube.com/watch?v=MrBzgvUNr4w&list=PL2-dafEMk2A6QKz1mrk1uIGfHkC1zZ6UU&index=5) - [Part 6: Genetic Algorithms](https://www.youtube.com/watch?v=dSofAXnnFrY&index=6&list=PL2-dafEMk2A6QKz1mrk1uIGfHkC1zZ6UU) -- [Build a python script to fetch daily temperature readings and run statistics on it](https://github.com/NivedhGovil/Matplotlib-guide-and-weather-project) +- [Build a python script to fetch daily temperature reading](https://github.com/NivedhGovil/Matplotlib-guide-and-weather-project) ### Machine Learning: - [Write Linear Regression From Scratch in Python](https://www.youtube.com/watch?v=uwwWVAgJBcM) (video)