Data Science · मराठी आवृत्ती
22.3 savefig ने charts जतन करणं
या course चे सर्व chapters (py + ch)
- How to Use This Free Data Science Course
- How to Install Python, Jupyter Notebook and VS Code for Data Science (Windows and Mac)
- Python Variables and Data Types Explained for Beginners (int, float, str, bool)
- Python Strings Tutorial: Slicing, f-strings and String Methods with Examples
- Python Lists, Tuples, Dictionaries and Sets Explained with Examples
- Python if, elif and else Statements with Real Examples for Beginners
- Python for Loops and while Loops Explained with Examples (range, break, continue)
- Python Functions Tutorial: def, return, Arguments and lambda with Examples
- Python Errors and Exceptions: How to Use try, except, else and finally
- How to Read and Write CSV, JSON and Text Files in Python (with open and with)
- Python Modules, pip and Virtual Environments (venv) Explained for Beginners
- Python Classes and Objects for Beginners: OOP Basics with Simple Examples
- NumPy Tutorial for Beginners: Arrays, Maths and Filtering in Python
- Python Mini Projects for Beginners: 5 Practice Projects Before Learning pandas
- Data Science vs Data Analytics Tutorial
- Python Jupyter Setup for Data Science
- Python Basics for Data Science Tutorial
- NumPy Essentials for Data Science Tutorial
- pandas DataFrames and Series Tutorial
- Filter and Sort Data in pandas Tutorial
- pandas GroupBy and Aggregations Tutorial
- Merge and Concat Data in pandas Tutorial
- Data Cleaning in pandas A–Z Tutorial
- Dates and Text in pandas – Free Tutorial
- Reshape Data: melt and pivot_table
- Exploratory Data Analysis in Python
- matplotlib Visualization Tutorial – Free
- seaborn Visualization Tutorial – Free
- Chart Choice and Data Storytelling
- Data Science Project: Blinkit Maharashtra
- Data Science Practice Exercises
- Data Science Interview Questions
- pandas matplotlib seaborn Cheat Sheet
- Data Science Glossary – Free Tutorial
- Stats for Data Work Mean Median IQR
- Export CSV Excel PNG from pandas Tutorial
- Common pandas Mistakes and Fixes Tutorial
- Load SQL Query Results into pandas DataFrame – Free Tutorial
- How to Rank and Running Totals in pandas
- How to Read APIs, JSON and Zipped CSVs into pandas
- How to Use Git with Jupyter Notebooks for Data Projects
- How to Merge and Join Tables in pandas for Blinkit Data
- What Is Machine Learning Simple Explanation
- Machine Learning Workflow Step by Step
- Train Test Split in Machine Learning sklearn
- Features and Labels in Machine Learning
- Linear Regression in Python with sklearn
- Classification with Logistic Regression in Python
- Decision Trees and Random Forests in Python
- K-Means Clustering in Python for Beginners
- How to Check If Your ML Model Is Good
- Overfitting and Underfitting in Machine Learning
- End-to-End ML Project India Dataset
- Data Preprocessing for ML: Impute Scale Encode
- What Is a Neural Network Simple Explanation
- Activation Loss Gradient Descent Plain English
- Backpropagation Intuition No Heavy Maths
- Install PyTorch and First Tensors
- Your First Neural Network in PyTorch
- Deep Learning vs Classical ML When to Use Which
- Convolutional Neural Networks CNNs for Images
- Small CNN Image Project in PyTorch
- What Transformers Are Text and Sequences
- Tiny Text Classifier Transformer Intro PyTorch
- What Is Natural Language Processing NLP
- Text Cleaning and TF-IDF in Python sklearn
- Sentiment Analysis Project in Python TF-IDF
- NLP vs ChatGPT Classical NLP and Generative AI
हे का शिकायचं?
Screenshot म्हणजे blurry आणि असंगत. Code मधून PNG काढा.
हे काय आहे?
matplotlib/seaborn plot नंतर plt.savefig('figures/....png', dpi=150, bbox_inches='tight').
कसं करायचं?
Step 1. figures/ folder तयार करा.
Step 2. Chart काढा.
Step 3. savefig dpi=150.
Step 4. Notebook मध्ये फक्त दाखवणं आणि file वेगळं ठेवणं.
उदाहरणं: copy करा आणि चालवा
उदाहरण A — Bar chart PNG.
import matplotlib.pyplot as plt
from pathlib import Path
Path("figures").mkdir(exist_ok=True)
delivered = df.loc[df["status"].eq("Delivered")]
city_gmv = delivered.groupby("city")["amount"].sum().sort_values(ascending=False)
fig, ax = plt.subplots(figsize=(8, 4))
city_gmv.plot(kind="bar", ax=ax, color="#2563eb", edgecolor="black")
ax.set_ylabel("GMV (₹)")
ax.set_xlabel("City")
ax.set_title("Delivered GMV by city — fictional Blinkit / Amazon Now sample")
fig.savefig("figures/city_gmv.png", dpi=120, bbox_inches="tight")
plt.close(fig)
print("wrote figures/city_gmv.png")
उदाहरण B — Seaborn + savefig.
import seaborn as sns
fig, ax = plt.subplots(figsize=(7, 4))
sns.barplot(data=summary, x="city", y="gmv_inr", hue="status", ax=ax)
ax.set_title("GMV by city and status (fictional)")
ax.set_ylabel("GMV (₹)")
ax.tick_params(axis="x", rotation=30)
fig.savefig("figures/city_status_gmv.png", dpi=120, bbox_inches="tight")
plt.close(fig)
उदाहरण C — Phone-friendly size.
fig, ax = plt.subplots(figsize=(6, 4)) # taller than wide for status cards
ax.plot([1, 2, 3, 4], [120, 150, 180, 210], marker="o")
ax.set_title("Kolhapur fictional daily delivered orders")
ax.set_xlabel("Day in sample week")
ax.set_ylabel("Orders")
fig.savefig("figures/kolhapur_trend.png", dpi=150, bbox_inches="tight")
plt.close(fig)
Rani sends kolhapur_trend.png to the Kolhapur group with one caption line — not the notebook.