-1

thanks for reading my question !

I created plot using Pyplot, this is my data :

enter image description here

Length of "point" array is : 114745

Length of "id_item" array is : 114745

Length of "sessions" array is : 92128

And this is my code :

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()

And this is result :

enter image description here

As you can see, values very close and hard to see.

I want value in id_item show full value and values in the center (sessions) easy to see.

Thanks very much to help me.

Phan Duc
  • 141
  • 1
  • 8

1 Answers1

1

There are two ways to fix your plot:

  1. Make the plot so large that you have to scroll down pages to see every session ID.
  2. Reduce your data / don't display everything.

Personally, I'd take option 2. At a certain point it becomes impossible or just really ugly to display a certain amount of points, especially with labels assigned to them. You will have to make sacrifices somewhere.

Edit: If you really want to change your figure size, look here for a thread explaining how to do that.

Community
  • 1
  • 1
Ian
  • 1,688
  • 18
  • 35
  • thanks for your advice ! Maybe display all sessionID is not the good idea and that data already reduce. So i don't display sessionID is the best way. – Phan Duc Jul 05 '16 at 09:52
  • You're welcome! Sometimes there just isn't a satisfying solution and you have to change your approach to the problem and go back a step to think about what you really want your plot to show. – Ian Jul 05 '16 at 10:37