⏱️4 min read · 825 words
2026 সালে পাইথন ডেটা ভিজ্যুয়ালাইজেশন দ্রুত অনুসন্ধানমূলক চার্ট থেকে প্রকাশনার জন্য প্রস্তুত পরিসংখ্যান এবং ইন্টারেক্টিভ ড্যাশবোর্ড পর্যন্ত বিস্তৃত। Matplotlib, Seaborn, Plotly এবং Altair প্রত্যেকেরই তাদের শক্তি আছে। এই নির্দেশিকা আপনাকে দেখায় যে কখন প্রতিটি ব্যবহার করতে হবে এবং কীভাবে দ্রুত পেশাদার ফলাফল তৈরি করতে হবে।
📋 Table of Contents
ভিজ্যুয়ালাইজেশন স্ট্যাক
- ম্যাটপ্লটলিব— ভিত্তি, সম্পূর্ণ নিয়ন্ত্রণ, প্রকাশনার পরিসংখ্যান
- সামুদ্রিক— পরিসংখ্যানগত প্লট, সুন্দর ডিফল্ট, পান্ডা ইন্টিগ্রেশন
- প্লটলি– ড্যাশবোর্ড এবং ওয়েব অ্যাপের জন্য ইন্টারেক্টিভ চার্ট
- আলটেয়ার— ঘোষণামূলক ব্যাকরণ, অনুসন্ধানমূলক বিশ্লেষণের জন্য চমৎকার
- ড্যাশ/স্ট্রিমলিট— পাইথনে সম্পূর্ণ ইন্টারেক্টিভ ড্যাশবোর্ড
Matplotlib: ভিত্তি
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
import numpy as np
# Figure and axes
fig, ax = plt.subplots(figsize=(10, 6))
# Line plot
x = np.linspace(0, 10, 200)
ax.plot(x, np.sin(x), label='sin(x)', linewidth=2, color='#0066CC')
ax.plot(x, np.cos(x), label='cos(x)', linewidth=2, color='#FF6600', linestyle='--')
# Styling
ax.set_title('Trigonometric Functions', fontsize=16, fontweight='bold', pad=15)
ax.set_xlabel('x', fontsize=12)
ax.set_ylabel('f(x)', fontsize=12)
ax.legend(fontsize=11)
ax.grid(True, alpha=0.3)
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
plt.tight_layout()
plt.savefig('trig.png', dpi=300, bbox_inches='tight')
plt.show()
# Subplots
fig, axes = plt.subplots(2, 2, figsize=(12, 8))
fig.suptitle('Multiple Plots', fontsize=16, fontweight='bold')
axes[0,0].hist(np.random.normal(0, 1, 1000), bins=30, color='steelblue', edgecolor='white')
axes[0,0].set_title('Normal Distribution')
axes[0,1].scatter(np.random.rand(50), np.random.rand(50), alpha=0.6, s=80)
axes[0,1].set_title('Scatter Plot')
x = ['A', 'B', 'C', 'D', 'E']
y = [23, 45, 12, 67, 34]
axes[1,0].bar(x, y, color=['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7'])
axes[1,0].set_title('Bar Chart')
axes[1,1].boxplot([np.random.normal(0, std, 100) for std in [1, 2, 3]])
axes[1,1].set_title('Box Plot')
plt.tight_layout()
plt.show()
সামুদ্রিক: পরিসংখ্যানগত ভিজ্যুয়ালাইজেশন
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
# Load sample dataset
tips = sns.load_dataset('tips')
# Set theme
sns.set_theme(style='whitegrid', palette='muted', font_scale=1.2)
# Distribution plots
fig, axes = plt.subplots(1, 3, figsize=(15, 5))
# Histogram + KDE
sns.histplot(tips['total_bill'], kde=True, ax=axes[0], color='steelblue')
axes[0].set_title('Total Bill Distribution')
# Box plot by category
sns.boxplot(data=tips, x='day', y='total_bill', hue='sex', ax=axes[1])
axes[1].set_title('Bills by Day and Gender')
# Violin plot
sns.violinplot(data=tips, x='time', y='tip', hue='smoker',
split=True, inner='quart', ax=axes[2])
axes[2].set_title('Tips Distribution')
plt.tight_layout()
plt.show()
# Correlation heatmap
corr = tips.select_dtypes(include='number').corr()
plt.figure(figsize=(8, 6))
sns.heatmap(corr, annot=True, fmt='.2f', cmap='coolwarm',
center=0, square=True, linewidths=0.5)
plt.title('Correlation Matrix')
plt.show()
# Pair plot
sns.pairplot(tips, hue='sex', plot_kws={'alpha': 0.6})
plt.suptitle('Pair Plot', y=1.02)
plt.show()
# FacetGrid — multiple plots by category
g = sns.FacetGrid(tips, col='time', row='smoker', height=4)
g.map_dataframe(sns.scatterplot, x='total_bill', y='tip', alpha=0.6)
g.add_legend()
g.set_titles(col_template='{col_name}', row_template='{row_name}')
plt.show()
প্লটলি: ইন্টারেক্টিভ চার্ট
import plotly.express as px
import plotly.graph_objects as go
import pandas as pd
# Simple line chart
df = px.data.gapminder().query("continent == 'Asia'")
fig = px.line(df, x='year', y='lifeExp', color='country',
title='Life Expectancy in Asia',
labels={'lifeExp': 'Life Expectancy', 'year': 'Year'})
fig.update_layout(
plot_bgcolor='white',
paper_bgcolor='white',
font_family='Inter',
showlegend=True,
)
fig.show() # opens in browser
# Animated scatter plot
df = px.data.gapminder()
fig = px.scatter(df, x='gdpPercap', y='lifeExp',
animation_frame='year',
animation_group='country',
size='pop', color='continent',
hover_name='country',
log_x=True,
size_max=55,
range_x=[100, 100000],
range_y=[25, 90],
title='World Health and Wealth (1952-2007)')
fig.show()
# Custom chart with graph_objects
fig = go.Figure()
x = ['Q1', 'Q2', 'Q3', 'Q4']
fig.add_trace(go.Bar(name='2025', x=x, y=[23, 45, 56, 78], marker_color='#4C72B0'))
fig.add_trace(go.Bar(name='2026', x=x, y=[34, 52, 61, 89], marker_color='#DD8452'))
fig.add_trace(go.Scatter(name='Target', x=x, y=[30, 50, 65, 85],
mode='lines+markers', line=dict(color='red', dash='dash')))
fig.update_layout(
title='Quarterly Revenue 2025 vs 2026',
xaxis_title='Quarter',
yaxis_title='Revenue ($M)',
barmode='group',
hovermode='x unified'
)
fig.show()
# Export to HTML
fig.write_html('chart.html')
# Export static image (requires kaleido)
fig.write_image('chart.png', width=1200, height=600, scale=2)
স্ট্রিমলিট: তাত্ক্ষণিক ড্যাশবোর্ড
pip install streamlit plotly pandas
# dashboard.py
import streamlit as st
import plotly.express as px
import pandas as pd
st.set_page_config(page_title='Sales Dashboard', layout='wide')
st.title('Sales Analytics Dashboard')
# Sidebar filters
with st.sidebar:
st.header('Filters')
year = st.selectbox('Year', [2024, 2025, 2026])
region = st.multiselect('Region', ['North', 'South', 'East', 'West'],
default=['North', 'South'])
# KPI metrics
col1, col2, col3, col4 = st.columns(4)
col1.metric('Total Revenue', '$2.4M', '+12%')
col2.metric('Orders', '1,847', '+8%')
col3.metric('Avg Order Value', '$1,299', '+4%')
col4.metric('Satisfaction', '4.7/5', '+0.2')
# Charts in two columns
c1, c2 = st.columns(2)
with c1:
fig = px.line(get_monthly_data(year), x='month', y='revenue',
title='Monthly Revenue')
st.plotly_chart(fig, use_container_width=True)
with c2:
fig = px.pie(get_regional_data(region), values='revenue',
names='region', title='Revenue by Region')
st.plotly_chart(fig, use_container_width=True)
# Data table
st.subheader('Recent Orders')
df = get_orders(year, region)
st.dataframe(df, use_container_width=True)
# Run: streamlit run dashboard.py
সঠিক টুল নির্বাচন করা
| টাস্ক | সেরা টুল |
|---|---|
| প্রকাশনার পরিসংখ্যান | ম্যাটপ্লটলিব |
| পরিসংখ্যানগত বিশ্লেষণ | সামুদ্রিক |
| ইন্টারেক্টিভ ওয়েব চার্ট | প্লটলি |
| দ্রুত ড্যাশবোর্ড | স্ট্রিমলিট |
| গ্রাফিক্সের ব্যাকরণ | আলটেয়ার |
| উৎপাদন ড্যাশবোর্ড | ড্যাশ |
2026 সালে পাইথন ভিজ্যুয়ালাইজেশন এর চেয়ে শক্তিশালী ছিল না। অনুসন্ধানমূলক বিশ্লেষণের জন্য Seaborn ব্যবহার করুন, ইন্টারেক্টিভ রিপোর্টের জন্য Plotly এবং প্রকাশনা-মানের পরিসংখ্যানের জন্য Matplotlib ব্যবহার করুন। Streamlit যেকোন বিশ্লেষণকে কয়েক মিনিটের মধ্যে শেয়ারযোগ্য ড্যাশবোর্ডে পরিণত করে।
🔗 Share this article
✍️ Leave a Comment