Code
import matplotlib.pyplot as plt
import numpy as np
= np.linspace(0, 10, 100)
x = np.sin(x)
y
=(10, 6))
plt.figure(figsize
plt.plot(x, y) plt.show()
Customizing Plots with Matplotlib and Seaborn
# Load the tips dataset
tips = sns.load_dataset("tips")
# Display the first few rows and data types
print(tips.head())
print("\nData Types:")
print(tips.dtypes)
# Select only numeric columns for correlation
numeric_columns = tips.select_dtypes(include=[np.number]).columns
tips_numeric = tips[numeric_columns]
total_bill tip sex smoker day time size
0 16.99 1.01 Female No Sun Dinner 2
1 10.34 1.66 Male No Sun Dinner 3
2 21.01 3.50 Male No Sun Dinner 3
3 23.68 3.31 Male No Sun Dinner 2
4 24.59 3.61 Female No Sun Dinner 4
Data Types:
total_bill float64
tip float64
sex category
smoker category
day category
time category
size int64
dtype: object
/var/folders/bs/x9tn9jz91cv6hb3q6p4djbmw0000gn/T/ipykernel_18509/2996973332.py:2: FutureWarning:
Passing `palette` without assigning `hue` is deprecated and will be removed in v0.14.0. Assign the `x` variable to `hue` and set `legend=False` for the same effect.
sns.boxplot(data=tips, x="day", y="total_bill", palette="Set3")
<Figure size 1152x576 with 0 Axes>
Remember, you can always combine Matplotlib and Seaborn customizations for even more control over your visualizations!