Re: Matplotlib-users Digest, Vol 48, Issue 2

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: Matplotlib-users Digest, Vol 48, Issue 2

Animatore. TRPS03000X
Dears all,
I solved the issue changing the command
  'ani = animation.FuncAnimation(fig, run, data_gen, blit=True, interval=5,repeat=True) '
and my Open Physics Laboratory works fine!!
Thanks a bunch far all!

Il giorno mar 16 lug 2019 alle ore 18:02 <[hidden email]> ha scritto:
Send Matplotlib-users mailing list submissions to
        [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to
        [hidden email]

You can reach the person managing the list at
        [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Matplotlib-users digest..."

Today's Topics:

   1. Help request serila data plot, Ubuntu 18 (Animatore. TRPS03000X)


Message: 1
Date: Mon, 15 Jul 2019 21:05:16 +0200
From: "Animatore. TRPS03000X" <[hidden email]>
To: [hidden email]
Subject: [Matplotlib-users] Help request serila data plot, Ubuntu 18
        <CACxvrmM6QZKih4d5Zr_8s38Usf2kbEfhwkqw=[hidden email]>
Content-Type: text/plain; charset="utf-8"

Dear matplot users,

I have installed Ubuntu 18 on my computer and Matplotlib, I use it to graph
position vs. time of moving objects by serial data.

The python script is the following:

import matplotlib


import numpy as np

import matplotlib.pyplot as plt

import matplotlib.animation as animation

from time import sleep

import serial

import time



while (fine != "f"):

     raw_input("\n\n\n Premi Enter per far partire la registrazione dei

     xdata, ydata = [], []

     ser = serial.Serial('/dev/ttyACM0', 9600)

     while (False):



     prec = float(pre)


     fig, ax = plt.subplots()

     line, = ax.plot([], [], lw=2)

     ax.set_ylim(0, 90)

     ax.set_xlim(0, 10)


     def data_gen():





        a = ser.readline()

        while (True)&(t < 10):

            a = ser.readline()

            y = float(a)

            if (y != 0) :

                t = (time.time() - start)

                t = float(t)

                yield t, y

     def run(data):

         t,y = data




        line.set_data(xdata, ydata)

       return line,

data_gen.t = 0

while (abs(y-prec) < 2):

    if True:

         a = ser.readline()

         y = float(a)

         start = time.time()

 ani = animation.FuncAnimation(fig, run, data_gen, blit=True,

 stop =0

fine=raw_input("Premi f per finire :")

It works fine, but after the plotting (10 seconds), there is a problem, I
cannnot use the tools of the matplot window, i.e. when I try to zoom, after
selecting the area, the plot desappear.

Can you help me?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>


Subject: Digest Footer

Matplotlib-users mailing list
[hidden email]


End of Matplotlib-users Digest, Vol 48, Issue 2

Matplotlib-users mailing list
[hidden email]