I'm trying to get the points to gradually increase in size. I believe I need to pass the size argument a list of n
values (n
representing the size of the array). So to this end, I'm using the linspace function to create the list of values that range from small to larger and passing it into a function as an argument. It's working generally, but I have two questions:
Thanks for any assistance.enter image description here
# function
def plotdata(data):
fig = plt.figure(figsize=(10,5))
# plot
plt.title("2D Data",size="15")
plt.xlabel("x")
plt.ylabel("y")
plt.scatter(x, y, s=size, c=color, marker='o', cmap='copper')
plt.xlim(-2, 2)
plt.ylim(-2, 2)
# Creating variables
x = data[["x"]]
y = data[["y"]]
limits=[-2.25, 2.25, -2.25, 2.25]
row,col=5,5
size = np.arange(1, row*col + 1)
color = np.array([np.linspace(0,1, row*col),
np.linspace(0,0.3, row*col),
np.linspace(0,0.3, row*col)]).T
2 possibilities:
1.
size = np.arange(1, row*col + 1)
I think this is the error, I don't think it is adding the 1 since the graph is weird.
(likely)
plt.scatter(x, y, s=size, c=color, marker='o', cmap='copper')
plt.title("2D Data",size="15")
size = np.arange(1, row*col + 1)
you define size many times best of luck, it has been a while since I've used this API though