How can I plot many thousands of circles quickly?

后端 未结 4 477
耶瑟儿~
耶瑟儿~ 2021-02-09 00:08

I\'m trying to plot several (many thousands) of circle objects - I don\'t have much experience working with python. I\'m interested in specifying the position, radius and color

4条回答
  •  一整个雨季
    2021-02-09 00:29

    scatter is probably better for you than plt.Circle though it won't make anything run faster.

    for i in range(4):
        mp.scatter(xvals[i], yvals[i], s=rvals[i])
    

    If you can deal with the circles being the same size then mp.plot(xvals[i], yvals[i], marker='o') will be more performant.

    But this is probably a matplotlib limitation, rather than a language limitation. There are excellent JavaScript libraries for plotting thousands of data points efficiently (d3.js). Maybe someone here will know of one that you can call from Python.

提交回复
热议问题