2016-07-05 101 views
-1

感谢您阅读我的问题!Python绘图修复大小

我创建使用Pyplot情节,这是我的数据: “点” 阵列的

enter image description here

长度:114745

“id_item” 数组的长度为:114745

“会话”数组的长度为:92128

这是我的代码:

point = [] 
id_item = [] 
sessions = [] # temp_dict.keys() 

for item in cursor_fromCompanyDB: 
    sessions.append(item['sessionId']) 
    for object_item in item['objects']: 
     point.append(object_item['point']) 
     id_item.append(object_item['id']) 


plt.figure() 
plt.title('Scatter Point and Id of SessionId', fontsize=20) 
plt.xlabel('point', fontsize=15) 
plt.ylabel('Item', fontsize=15) 
plt.scatter(point, id_item, marker = 'o') 
plt.autoscale(enable=True, axis=u'both', tight=False) 

for label, x, y in zip(sessions, point, id_item): 
    plt.annotate(label, xy = (x, y)) 

plt.show() 

这是结果:

enter image description here

正如你所看到的,值非常接近,很难看到。

我想在值id_item显示在中心(会话)容易看到的全部价值和价值。

非常感谢您的帮助。

+0

你有92,000分,我怀疑它很容易就能看到完整的价值而不会产生巨大的数字, – GWW

+0

@GWW,'为什么我问谁有更好的解决方案! –

回答

1

有两种方法可以解决你的情节:

  1. 使情节如此之大,你必须向下滚动页面,看到每一个会话ID。
  2. 减少您的数据/不显示所有内容。

就我个人而言,我会采取选项2.在某个点上,显示一定数量的点(特别是分配给它们的标签)变得不可能或者非常难看。你将不得不在某个地方做出牺牲。

编辑:如果你真的想改变你的身材尺寸,look here for a thread explaining how to do that

+0

感谢您的咨询!也许显示所有sessionID不是好主意,数据已经减少。所以我不显示sessionID是最好的方法。 –

+0

不客气!有时候只是没有一个令人满意的解决方案,你必须改变你的解决问题的方法,并回过头来思考你真正想让你的情节展现出什么。 – Ian