Giter Club home page Giter Club logo

Comments (1)

piccolomo avatar piccolomo commented on August 22, 2024

Hi ThSGM,

thanks for the comment. I tried your code and it worked well on my machine. I would try to tweak the sleeping time in sleep(time) to adapt it to your machine.

Another thing you could try is to fix the sleeping time to 0 or to a minimum and increase the n_points till it works (you may have forgotten a pi in t).
Also notice that when the plot clears, it clears also all the plot style.

Here is the revised code:

#!/usr/bin/env python3
import plotext.plot as plx
import numpy as np

pi = np.pi
n_points = 50
x = np.linspace(0, 2 * pi, n_points)
y = np.sin(x)
t = np.linspace(0, 2 * pi, n_points)

for tt in t:
    plx.clear_plot()
    plx.clear_terminal()
    
    y = np.sin(x - tt)
    plx.scatter(x, y)

    plx.set_cols(100)
    plx.set_rows(100)
    plx.set_ylim([-1.1, 1.1])
    plx.set_xlim([0, 2 * pi])
    plx.set_axes_color("green")
    plx.set_background("black")
    plx.set_spacing([5, 8])
    
    plx.sleep(0.2)
    plx.show()

Let me know if you find a way to make it work. All the best.

from plotext.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.