Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Scatter plot marker size calculation

I have a very specific problem. I have two numpy arrays and the corresponding element of each array represent a 2d point.

a = [1,2,1,6,1]

b = [5,0,3,1,5]

I want to plot a scatter plot where the size of the marker is based on how many times than point occurs.

That is :

1,5 : 2

2,0 : 1

1,3 : 1

6,1 : 1

So the size array must be size = [2,1,1,1] and other two arrays can be

a = [1,2,1,6] and b = [5,0,3,1]

So I must be able to call plt.scatter as follows:

plt.scatter(a,b,s=size)

Answer*

Cancel
0