Key Points
When drawing the scattergram, it is generally used as a carrier for the variable input data.
In fact, the string may be used as input data storage carrier.
The following code data = {“a”: x, “b”: y, “color”: c, “size”: s}
is input to the scattergram data, color and markings on the size of the data dictionary data as a key-value pair corresponding to the key is a string string.
Matplotlib programming
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.gca()
x = np.random.rand(50)*10
y = np.random.rand(50)*10+20
s = np.random.rand(50)*100
c = np.random.rand(50)
data = {"a": x, "b": y, "color": c, "size": s}
# with the "data" keyboard argument
ax.scatter("a", "b", c="color", s="size", data=data)
ax.set(xlabel="X", ylabel="Y")
plt.show()