Franco Hh
Franco Hh

Reputation: 211

Graph with too many points

I coded a python script to get a graph which dynamically change in a file. Here the code:

def get_plot():
  print self.data1 #initialized to [0,0,0,0]
  print '\n'
  plt.subplot(111)
  data0 = 0,1,2,3
  p1=plt.plot(data0,self.data1,'ro')
  plt.setp(p1, linewidth=0.5, color='r')
  .....
  plt.savefig("file.png")

I use a function to call repeteadly the function above. If I check the self.data1 values, all works cause they change dynamically like I want. But, the graph which is saved contains 4 values for each value of data0, instead of just one.

Suggestions?

Upvotes: 0

Views: 364

Answers (1)

mechanical_meat
mechanical_meat

Reputation: 169544

I think there might be something you're not telling us.
I run the following:

plt.subplot(111)
data0 = 0,1,2,3
p1 = plt.plot(data0,[0,0,0,0],'ro')
plt.setp(p1, linewidth=0.5, color='r')
plt.show()

And get:

enter image description here

Upvotes: 1

Related Questions