通过价值重复分散或泡泡绘图
我有一组数字序列保存在2D列表中。列表中的每个元素都是不同长度的子列表,例如1-10范围内的数字。这样:
Lst = [[1,3,4,4,4,5],[2,7,2,3],[6,5,4,2,4],[2,4,5,7,5,4,2],[4,9,4,1,4,5,4]…]
是否有一种方法可以通过使用matplotlib绘制这些数据散布或气泡绘制的绘图?列表中的每个元素都占X轴上的位置,并且该元素中的所有值均分布在相应的Y轴位置,并且重复值的次数越多,绘制的尺寸或深色越大观点。
我已经知道如何使用matplotlib图散点图,但是我不知道如何一个y轴上绘制一个y轴上的项目。
谢谢。
I have a set of sequences of numbers that are kept in a 2D list. Each element in the list is a sublist of varying lengths, say numbers in the range 1-10. Like this:
Lst = [[1,3,4,4,4,5],[2,7,2,3],[6,5,4,2,4],[2,4,5,7,5,4,2],[4,9,4,1,4,5,4]…]
Is there a way to draw plot these datas in scatter or bubble plotting with value duplication by use matplotlib? Each element in the list occupies a position on the X-axis, and all the values in the element are distributed in the corresponding Y-axis position, and the more times the value is repeated, the larger the size or dark color of the drawn point.
I already know how to use matplotlib plot scatter plotting, but I don't know how to plot a 2D list item on one Y-axis one by one.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您只需在for循环中绘制每个子列表:
输出:

编辑:满足要点也变得更黑暗的请求。使用此处的答案:变暗或变暗或照亮matplotlib的颜色
输出 :

You can just plot each sublist in a for loop:
Output:

Edit: Fulfilling request for points to also become darker. Using the answer from here: Darken or lighten a color in matplotlib
Output:
