import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs
# Generate a random dataset
X, y = make_blobs(n_samples=100, centers=4, n_features=2, random_state=42)
# Create a faceted plot using subplots
fig, ax = plt.subplots(nrows=2, ncols=2)
# Define the subsets of data for each subplot
subset1 = X[y == 0]
subset2 = X[y == 1]
subset3 = X[y == 2]
subset4 = X[y == 3]
# Plot the subsets of data on the different subplots
ax[0, 0].scatter(subset1[:, 0], subset1[:, 1])
ax[0, 0].set_title('Category 0')
ax[0, 1].scatter(subset2[:, 0], subset2[:, 1])
ax[0, 1].set_title('Category 1')
ax[1, 0].scatter(subset3[:, 0], subset3[:, 1])
ax[1, 0].set_title('Category 2')
ax[1, 1].scatter(subset4[:, 0], subset4[:, 1])
ax[1, 1].set_title('Category 3')
# Set the overall title for the plot
fig.suptitle('Faceted Plot')
# Show the plot
plt.show()