Python Forum
Plot on gui window
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plot on gui window
#2
Sorry but the second code must be this one

import matplotlib.pyplot as plt
import matplotlib.animation as animation
import time

fig = plt.figure()

def animate(i):
	
	ax1 = fig.add_subplot(1,1,1)
	pullData1 = open("data1.txt","r").read()
	dataArray1 = pullData1.split('\n')
	xar = []
	yar = []
	
	for eachLine in dataArray1:
		if len(eachLine)>1:
			x1,y1 = eachLine.split(',')
			xar.append(int(x1))
			yar.append(int(y1))
	ax1.clear()
	ax1.plot(xar,yar)
	
ani = animation.FuncAnimation(fig, animate, interval=1000)
plt.show()
Reply


Messages In This Thread
Plot on gui window - by macellan85 - Jul-24-2018, 01:59 PM
RE: Plot on gui window - by macellan85 - Jul-24-2018, 02:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Interaction between Matplotlib window, Python prompt and TKinter window NorbertMoussy 3 876 Mar-17-2024, 09:37 AM
Last Post: deanhystad
  tkinter window and turtle window error 1885 3 6,887 Nov-02-2019, 12:18 PM
Last Post: 1885
  update a variable in parent window after closing its toplevel window gray 5 9,324 Mar-20-2017, 10:35 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020