AI-GENERATED COURSE CONTENT — PUBLISHED AS IS. This new lesson is AI-generated, based on questions and topic collections from Open Education, including source articles attributed to Sayed Ahmed where indicated. The new AI-generated prose, original synthetic-data plots and original code are offered for reuse without copyright restrictions asserted by this site. Third-party references have separate rights. AI can make mistakes; independently check code, statistics, and interpretations.
Course: Advanced Data Visualization – 001 — course syllabus. Original source posts: Post 16057 · Post 16051 · Post 16059 · Post 16321.
Learning focus. The existing BASIC CHARTS resource collection asks learners to examine histogram bins, nonuniform bin widths, frequency polygons, bar charts and boxplots. These charts answer different questions and must not be treated as interchangeable.

Theory and algorithmic reasoning
Use bars for discrete categories and histograms for a continuous quantitative variable grouped into intervals. A histogram with unequal bin widths must encode density as height, so area—not bar height—corresponds to count.
A frequency polygon joins bin-midpoint frequencies. A boxplot displays median, quartiles, whiskers and possible outliers; it does not reveal all modes or the sample size on its own.
Mathematical ideas
Freedman–Diaconis suggested bin width: h=2·IQR·n^(−1/3). Histogram frequency density in bin i is nᵢ/(n·widthᵢ).
Python: Reproducible plot
import numpy as np
import matplotlib.pyplot as plt
x = np.array([10,11,12,12,14,15,16,17,18,20,21,23,26,29])
edges = np.array([10,15,20,30])
counts, edges = np.histogram(x, bins=edges)
midpoints=(edges[:-1]+edges[1:])/2
fig, ax=plt.subplots(figsize=(7,4))
ax.hist(x,bins=edges,density=True,alpha=.55,label="density")
ax2=ax.twinx()
ax2.plot(midpoints,counts,marker="o",label="frequency")
ax.set(xlabel="Value",ylabel="Probability density")
ax2.set_ylabel("Frequency")
plt.tight_layout();plt.show()
print(counts)
R: Reproducible plot with ggplot2
library(ggplot2)
x <- c(10,11,12,12,14,15,16,17,18,20,21,23,26,29)
df <- data.frame(value=x)
ggplot(df, aes(value)) +
geom_histogram(breaks=c(10,15,20,30),
aes(y=after_stat(density)), fill="#4180ad",
color="white") +
labs(title="Unequal-width histogram",y="Density") +
theme_minimal()
print(table(cut(x,breaks=c(9.99,15,20,30))))
Expected output and interpretation
Bin frequencies using NumPy’s left-closed/right-open bins are [5, 4, 5] for [10,15), [15,20), [20,30]. Their widths differ, so a frequency-density chart does not confuse area with height. R cut() uses right-closed intervals by default; specify boundaries when comparing bins.
Questions and answers
Q1. What is the difference between a histogram and a bar chart?
Answer. Histogram bins cover adjacent numeric intervals; bars compare discrete categories, and their order/spacing have different meanings.
Q2. Why can a boxplot hide information?
Answer. Distinct datasets can have similar quartiles while differing in multimodality, skew or sample sizes.
Q3. How many bins should we choose?
Answer. Use a transparent rule such as Freedman–Diaconis, then assess sensitivity to the choice and data size.
Assessment and practical exercise
Create both a histogram and a boxplot for one numeric variable. Change the bin widths, annotate the median, and explain whether the interpretation changes.
Translated to Bengali / বাংলায় অনুবাদ
বাংলা অনুবাদ: এই পাঠের ব্যাখ্যামূলক লেখা ও প্রশ্নোত্তরের সহজ, যথাযথ বাংলা অনুবাদ নিচে দেওয়া হলো। Python ও R কোড অপরিবর্তিত রয়েছে; উপরের কোড চালিয়ে চার্ট তৈরি করুন।
শেখার বিষয়: সাইটের BASIC CHARTS উৎসে হিস্টোগ্রামের শ্রেণিবিন্যাস, অসম প্রস্থের বিন, ফ্রিকোয়েন্সি পলিগন, বার চার্ট ও বক্সপ্লট রয়েছে। প্রতিটি চার্ট ভিন্ন প্রশ্নের উত্তর দেয়।
বিচ্ছিন্ন শ্রেণির জন্য বার চার্ট এবং ধারাবাহিক সংখ্যার জন্য হিস্টোগ্রাম ব্যবহার করুন। হিস্টোগ্রামের বিনের প্রস্থ সমান না হলে দণ্ডের উচ্চতা ঘনত্ব বোঝাবে, যাতে দণ্ডের ক্ষেত্রফল গণনার সমানুপাতিক হয়।
ফ্রিকোয়েন্সি পলিগন বিনের মধ্যবিন্দুগুলোর ফ্রিকোয়েন্সি যুক্ত করে। বক্সপ্লটে মধ্যক, চতুর্থাংশ ও সম্ভাব্য ব্যতিক্রমী মান দেখা যায়; কিন্তু এটি একা সব শীর্ষবিন্দু বা নমুনার আকার প্রকাশ করে না।
গাণিতিক ধারণা: Freedman–Diaconis সূত্রে বিনের প্রস্থ h=2·IQR·n^(−1/3)। i নম্বর বিনে ফ্রিকোয়েন্সি ঘনত্ব nᵢ/(n·widthᵢ)।
প্রত্যাশিত ফল: NumPy অনুযায়ী তিনটি বিনের ফ্রিকোয়েন্সি [৫, ৪, ৫]—যথাক্রমে [১০,১৫), [১৫,২০), [২০,৩০]। বিনের প্রস্থ আলাদা হওয়ায় ঘনত্ব ব্যবহার জরুরি। R-এর cut() সাধারণত ডান প্রান্ত অন্তর্ভুক্ত করে; তুলনার আগে নিয়ম মিলিয়ে নিন।
প্রশ্ন 1. হিস্টোগ্রাম ও বার চার্টের পার্থক্য কী?
উত্তর: হিস্টোগ্রামে সংখ্যার পাশাপাশি থাকা পরিসর দেখা হয়, আর বার চার্টে পৃথক শ্রেণির তুলনা করা হয়।
প্রশ্ন 2. বক্সপ্লট কেন তথ্য আড়াল করতে পারে?
উত্তর: ভিন্ন বণ্টনের মধ্যক ও চতুর্থাংশ একই হতে পারে; একাধিক শীর্ষবিন্দু বা নমুনার আকার গোপন থাকতে পারে।
প্রশ্ন 3. কতটি বিন নির্বাচন করব?
উত্তর: Freedman–Diaconis-এর মতো নিয়ম ব্যবহার করে ভিন্ন বিনে ফল কতটা বদলায় তা পরীক্ষা করুন।
বাংলা অনুশীলন
একটি সংখ্যাগত চলকের হিস্টোগ্রাম ও বক্সপ্লট তৈরি করুন। বিনের প্রস্থ বদলে মধ্যক দেখান এবং ব্যাখ্যা করুন ব্যাখ্যা কতটা বদলায়।
উৎস ও ব্যবহার: মূল লেখাগুলোর লিংক উপরে দেওয়া আছে। নতুন এআই-তৈরি ব্যাখ্যা ও নিজস্ব নমুনা-চিত্র পুনর্ব্যবহারযোগ্য; বাহ্যিক উৎসের স্বত্ব আলাদা। এআই ভুল করতে পারে, তাই ফল যাচাই করুন।
Discover more from Open Education
Subscribe to get the latest posts sent to your email.
