Lectures: Nguyễn Tuấn Phong, Đào Việt Anh
Labs: Trịnh Ngọc Huỳnh, Phạm Tiến Du
Semester: 2025-2026-1
Institute for AI, VNU-UET
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 2*np.pi, 200)
y = np.sin(x)
fig, ax = plt.subplots(figsize=(6,4))
ax.plot(x, y, linewidth=2)
ax.set(title="Sine wave", xlabel="x (rad)", ylabel="y")
fig.tight_layout()
# Renders a line chart (Figure)
import seaborn as sns
penguins = sns.load_dataset("penguins").dropna()
sns.kdeplot(
penguins,
x="body_mass_g",
hue="species",
fill=True
)
sns.ecdfplot(
penguins,
x="body_mass_g",
hue="species"
)
g = sns.FacetGrid(
penguins,
col="island",
hue="species",
height=3
)
g.map_dataframe(
sns.scatterplot,
x="bill_length_mm",
y="bill_depth_mm"
).add_legend()
# One column per island; colors map species
import plotly.express as px
tips = sns.load_dataset("tips")
fig = px.scatter(
tips, x="total_bill", y="tip", color="time",
size="size", facet_col="sex", trendline="ols",
title="Interactive scatter with facets"
)
fig.show()
import altair as alt
from vega_datasets import data
cars = data.cars()
alt.Chart(cars).mark_point().encode(
x="Horsepower", y="Miles_per_Gallon",
color="Origin", tooltip=["Name","Year","Cylinders"]
).properties(width=320, height=220)