import matplotlib.pyplot as plt
# Creating a scatter plot with different colors
x = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]
colors = ['red', 'green', 'blue', 'yellow', 'orange']
plt.scatter(x, y, c=colors)
plt.show()
# Setting multiple colors for a line plot
x = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]
colors = ['red', 'green', 'blue', 'yellow', 'orange']
plt.plot(x, y, color=colors)
plt.show()
# Creating a custom colormap
import numpy as np
x = np.linspace(0, 10, 100)
y = np.sin(x)
c = np.cos(x)
plt.scatter(x, y, c=c, cmap='viridis')
plt.colorbar()
plt.show()