DATA_VISUALIZATION_CHART
S
Line Chart
CODE
Definition: import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
• A line chart connects data points with a line, y = [10, 12, 8, 14, 13]
plt.plot(x, y, marker='o')
showing trends over time. plt.title('Line Chart Example')
plt.xlabel('Time')
Use-Case: plt.ylabel('Value')
plt.show()
• Used to visualize changes or trends in data over
time.
Applications:
• Stock prices, Website traffic, Temperature changes,
Sales performance.
Scatter
Plot
CODE
Definition: import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
• A graph of dots to show relationships between two y = [2, 4, 1, 3, 7]
plt.scatter(x, y)
variables. plt.title('Scatter Plot Example')
plt.xlabel('X-Axis')
Use-Case: plt.ylabel('Y-Axis')
plt.show()
• Used for correlation or regression analysis.
Applications:
• Height vs weight, Exam score vs study time,
Advertising vs sales, Age vs blood pressure.
Bar Chart
CODE
Definition: import matplotlib.pyplot as plt
categories = ['A', 'B', 'C', 'D']
• A chart with rectangular bars representing values = [23, 17, 35, 29]
plt.bar(categories, values)
categorical data. plt.title('Bar Chart Example')
plt.xlabel('Category')
Use-Case: plt.ylabel('Value')
plt.show()
• Used to compare values across categories.
Applications:
• Product sales, Population by region, Survey
responses, Revenue by department.
Box Plot
CODE
Definition:
import matplotlib.pyplot as plt
data = [7, 15, 36, 39, 42, 43, 46, 49, 50, 70]
• Displays data distribution using quartiles and plt.boxplot(data)
outliers. plt.title('Box Plot Example')
plt.show()
Use-Case:
• Used for statistical summary and outlier detection.
Applications:
• Exam score analysis, Income distribution, Product
review ratings, Medical data variability.
Pie Chart
CODE
Definition:
import matplotlib.pyplot as plt
labels = ['A', 'B', 'C', 'D']
• Circular chart divided into sectors showing sizes = [15, 30, 45, 10]
plt.pie(sizes, labels=labels, autopct='%1.1f%%')
percentage. plt.title('Pie Chart Example')
plt.show()
Use-Case:
• Used to show proportions or part-to-whole
relationships.
Applications:
• Market share, Budget breakdown, Device usage,
Election results.
Dot Chart
CODE
Definition:
import matplotlib.pyplot as plt
categories = ['A', 'B', 'C', 'D']
• A simple plot that uses dots to represent data values = [10, 20, 15, 25]
points. plt.plot(values, 'o')
plt.xticks(range(len(categories)), categories)
Use-Case: plt.title('Dot Chart Example')
plt.show()
• Used to compare small numbers of categories.
Applications:
• Survey result comparison, Small-scale
demographics, Test scores, Product ratings.
Map Chart
CODE
Definition: import plotly.express as px
import pandas as pd
• A chart that visualizes data across geographical data = {'Country': ['India', 'USA', 'China'], 'Value':
[100, 200, 300]}
locations. df = pd.DataFrame(data)
fig = px.choropleth(df, locations='Country',
Use-Case: locationmode='country names',color='Value', title='Map
Chart Example')
fig.show()
• Used for geo-spatial analysis and regional
comparison.
Applications:
• COVID-19 heatmaps, Population density, Sales by
region, Weather maps.
Guage
Chart
CODE
Definition: import plotly.graph_objects as go
fig = go.Figure(go.Indicator(
• A circular chart displaying a single data value within mode="gauge+number",
value=70,
a range. title={'text': "Gauge Chart Example"},
gauge={'axis': {'range': [0, 100]}}
Use-Case: ))
fig.show()
• Used to show performance indicators or progress.
Applications:
• Speedometer, KPI dashboards, Battery level, Server
load
Radar Chart
CODE
Definition:
import plotly.express as px
df = px.data.wind()
• A graphical method of displaying multivariate data in the fig = px.line_polar(df, r="frequency",
form of a 2D chart of three or more variables on axes. theta="direction", line_close=True)
fig.update_traces(fill='toself')
Use-Case: fig.show()
• Used to compare features or metrics across
categories.
Applications:
• Skill assessment, Product comparison, Sports stats,
Survey results.
Matrix
Chart
CODE
Definition:
import seaborn as sns
import matplotlib.pyplot as plt
• A chart that uses a grid to show relationships import numpy as np
data = np.random.rand(4, 4)
between two variables, often used as a heatmap. sns.heatmap(data, annot=True, cmap="YlGnBu")
plt.title("Matrix Chart Example")
Use-Case: plt.show()
• Used to identify patterns or correlations.
Applications:
• Confusion matrix, User clicks vs time, Performance
evaluation, Task assignments
Spatial
Chart
CODE
Definition: import networkx as nx
import matplotlib.pyplot as plt
• A graph where nodes and edges are embedded in G = nx.random_geometric_graph(10, 0.5)
pos = nx.get_node_attributes(G, 'pos')
physical or virtual space. nx.draw(G, pos, with_labels=True, node_color='skyblue')
plt.title("Spatial Graph Example")
Use-Case: plt.show()
• Used to represent geographic or physical
connections.
Applications:
• Transportation networks, IoT sensor layout, City
planning, Game map
Distribution
Chart
CODE
Definition: import seaborn as sns
import matplotlib.pyplot as plt
• A plot showing the distribution of a dataset data = sns.load_dataset("iris")
["sepal_length"]
(histogram + KDE). sns.histplot(data, kde=True)
plt.title("Distribution Plot Example")
Use-Case: plt.show()
• Used to visualize spread and skew of data.
Applications:
Applications:
• Income distribution, Exam scores, Website load
times, Medical stats.
Violin Chart
Definition: CODE
import seaborn as sns
• Combines box plot and KDE to show distribution and import matplotlib.pyplot as plt
density. data = sns.load_dataset("tips")
sns.violinplot(x="day", y="total_bill", data=data)
Use-Case: plt.title("Violin Plot Example")
plt.show()
• Used to compare distributions between multiple
groups.
Applications:
• Test score variation, Medical study results, Sales by
region, Product ratings.
Count
Chart
CODE
Definition: import seaborn as sns
import matplotlib.pyplot as plt
• Displays the count of observations in each data = sns.load_dataset("titanic")
sns.countplot(x="class", data=data)
categorical bin. plt.title("Count Plot Example")
plt.show()
Use-Case:
• Used to see frequency of categorical values.
Applications:
• Gender distribution, Survey answers, Item
frequency, Class imbalance.