GithubHelp home page GithubHelp logo

Comments (4)

maxhumber avatar maxhumber commented on July 22, 2024

Hey @sara-02!

You're the second person to ask for this functionality! 🙈 (#3)

If there I get 3 more people asking for it, I'll formalize it into a feature 🤓

For now you can work around with:

import gif
from matplotlib import pyplot as plt

x = list(range(100))
y = [10] * len(x)

@gif.frame
def plot(i):
    plt.plot(x[:i], y[:i])
    plt.xlim([0, max(x)])
    plt.ylim([0, max(y) * 2])
    if x[i] > 50 and x[i] < 70:
        plt.axvspan(50, x[i-1], facecolor="Red", ls="--", lw=2.0, alpha=0.2)
    if x[i] >= 70:
        plt.axvspan(50, 70, facecolor="Red", ls="--", lw=2.0, alpha=0.2)

frames = []
for i in range(len(x)):
    frame = plot(i)
    frames.append(frame)

# IMPORTANT SAVE CODE HERE:
frames[0].save(
    "dont_repeat.gif",
    save_all=True,
    append_images=frames[1:],
    duration=70
)

Which will produce (for some reason macOS Preview doesn't support non-looping gifs? But the web does?):

dont_repeat

Hope that helps!

from gif.

sara-02 avatar sara-02 commented on July 22, 2024

hey @maxhumber I tried a similar approach as you mentioned, still not able to stop the loop :/.
Can I share the gist code with you to have a look at?

from gif.

maxhumber avatar maxhumber commented on July 22, 2024

Sure! I'll take a look :)

from gif.

robertryanharrison avatar robertryanharrison commented on July 22, 2024

humble vote for the feature; noob here thanks for creating this package!

from gif.

Related Issues (9)

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.