0

This question is the next question of this one live plotting using pyserial and matplotlib

Now I can live plot the data but I want my plot must start to plot from y = 0, for example

var_y from device begin with 300, y = 0
var_y = 500 -> y = 200
var_y = 700 -> y = 400
and so on

This is my var_y variable capture using pyserial

self.var_y = np.array(self.data,dtype=object)[:,1]

no matter how var_y changes, my plot must alway start from y = 0

Community
  • 1
  • 1
billyduc
  • 692
  • 2
  • 8
  • 15

1 Answers1

0

take a look in the function ylim(). in your case you should use:

ax.set_ylim(0,someMaxValue)

this should be set everytime before you call

plt.show().
oz123
  • 27,559
  • 27
  • 125
  • 187