TGViewer
Data Science & Machine Learning Data Science & Machine Learning @datasciencefun · 77.8K subscribers
Post #3926 5.13K
✅ Python for Data Science: Part-4

Data Visualization with Matplotlib, Seaborn Plotly 📊📈

1️⃣ Matplotlib – Basic Plotting
Great for simple line, bar, and scatter plots.

Import and Line Plot
import matplotlib.pyplot as plt

x = [1, 2, 3, 4]
y = [10, 20, 25, 30]
plt.plot(x, y)
plt.title("Line Plot")
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
plt.show()

Bar Plot
names = ["A", "B", "C"]
scores = [80, 90, 70]
plt.bar(names, scores)
plt.title("Scores by Name")
plt.show()


2️⃣ Seaborn – Statistical Visualization
Built on Matplotlib with better styling.

Import and Plot
import seaborn as sns
import pandas as pd

df = pd.DataFrame({
"Name": ["Riya", "Aman", "John", "Sara"],
"Score": [85, 92, 78, 88]
})

sns.barplot(x="Name", y="Score", data=df)

Other Seaborn Plots
sns.histplot(df["Score"])          # Histogram  
sns.boxplot(x=df["Score"]) # Box plot


3️⃣ Plotly – Interactive Graphs
Great for dashboards and interactivity.

Basic Line Plot
import plotly.express as px

df = pd.DataFrame({
"x": [1, 2, 3],
"y": [10, 20, 15]
})

fig = px.line(df, x="x", y="y", title="Interactive Line Plot")
fig.show()


🎯 Why Visualization Matters
• Helps spot patterns in data
• Makes insights clear and shareable
• Supports better decision-making

Practice Task:
• Create a line plot using matplotlib
• Use seaborn to plot a boxplot for scores
• Try any interactive chart using plotly

💬 Tap ❤️ for more
  • ❤ 11
More from @datasciencefun
  1. Oct 17, 2026𝗜𝗕𝗠 𝗙𝗥𝗘𝗘 𝗧𝗘𝗖𝗛 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝟮𝟬𝟮𝟲! 🎓 Explore IBM Cognitive Class and build…
  2. Oct 16, 2026𝗗𝗮𝘁𝗮 𝘀𝗰𝗶𝗲𝗻𝗰𝗲 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗪𝗶𝘁𝗵 𝗔𝗜😍 Future Ready Data Scien…
  3. Oct 15, 2026Post #4665
  4. Oct 15, 2026Post #4664
  5. Oct 15, 2026Post #4663
  6. Oct 15, 2026Post #4662
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →