-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
28 lines (23 loc) · 674 Bytes
/
main.py
File metadata and controls
28 lines (23 loc) · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
#Matplotlib es el motor… Seaborn es el diseño bonito
# Crear datos
data = {
"Nombre": ["Ana", "Luis", "Carlos", "María", "Pedro"],
"Edad": [23, 25, 30, 22, 28],
"Salario": [12000, 15000, 20000, 11000, 18000]
}
df = pd.DataFrame(data)
# --- GRÁFICO 1: Matplotlib (Pyplot) ---
plt.figure(figsize=(8,5))
plt.bar(df["Nombre"], df["Salario"])
plt.title("Salario por Persona")
plt.xlabel("Nombre")
plt.ylabel("Salario")
plt.show()
# --- GRÁFICO 2: Seaborn ---
plt.figure(figsize=(8,5))
sns.scatterplot(data=df, x="Edad", y="Salario")
plt.title("Relación Edad vs Salario")
plt.show()