xxxxxxxxxx
import matplotlib.pyplot
matplotlib.pyplot.scatter([1,2,3],[4,5,6],color=['red','green','blue'])
xxxxxxxxxx
# plt background color
# make data
import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs
X, y = make_blobs(n_samples=50, n_features=2, random_state=0)
y = y.reshape((y.shape[0], 1))
# plot
plt.style.use('dark_background')
plt.scatter(X[:,0], X[:, 1], c=y, cmap='summer')
plt.show()
xxxxxxxxxx
import matplotlib.pyplot as plt
import numpy as np
ID = np.array([1,2,3,4,5,6,7,8,9,10])
marks = np.array([95,98,83,75,67,58,67,78,53,32])
plt.scatter(ID, marks, color= 'black')
plt.show()
xxxxxxxxxx
import matplotlib.pyplot as plt
a = random(100)*10
b = range(100)
fig = plt.figure(1)
ax = fig.add_subplot(111, axisbg='black')
ax.scatter(a,b)
fig.canvas.draw()
xxxxxxxxxx
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
x = np.arange(10)
ys = [i+x+(i*x)**2 for i in range(10)]
colors = cm.rainbow(np.linspace(0, 1, len(ys)))
for y, c in zip(ys, colors):
plt.scatter(x, y, color=c)
xxxxxxxxxx
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
population = np.random.rand(100)
Area = np.random.randint(100,600,100)
continent =['North America','Europe', 'Asia', 'Australia']*25
df = pd.DataFrame(dict(population=population, Area=Area, continent = continent))
fig, ax = plt.subplots()
colors = {'North America':'red', 'Europe':'green', 'Asia':'blue', 'Australia':'yellow'}
ax.scatter(df['population'], df['Area'], c=df['continent'].map(colors))
plt.show()