Giter Club home page Giter Club logo

Comments (8)

stevengj avatar stevengj commented on June 19, 2024

If you just want to block, why not do:

print("Hit <enter> to continue")
readline()

But it would be nice to provide a way to load PyPlot in non-interactive mode. (As I said on StackOverflow, if you just want non-interactive mode you could always @pyimport matplotlib.pyplot as plt directly...most of reason for PyPlot is to provide interactive graphics and IJulia integration. But you lose a few niceties of PyPlot that way.)

from pyplot.jl.

vchuravy avatar vchuravy commented on June 19, 2024

On a similar note.

I have a long running simulation and I would like to periodically update a Figure to show the progress of certain variables. Currently only the last plot will be updated and I also don't want to block.

My code looks like this

while t < largeNumber
   do calculation
   if t % interval
      plot([1:largeNumber], variable)
   end
   t += 1
end

Adding draw add the end of the call doesn't force an update.

from pyplot.jl.

stevengj avatar stevengj commented on June 19, 2024

Have you tried calling yield() occasionally so that the GUI event loop can run?

from pyplot.jl.

vchuravy avatar vchuravy commented on June 19, 2024

Thank you that was exactly what I needed

from pyplot.jl.

vchuravy avatar vchuravy commented on June 19, 2024

Any ideas how one could do that without yield? It seems to have pretty big performance penalty in my case attached to it. According to IProfile a quarter of my program runtime is spent waiting on yield.

It would be great if one could run the pyplot updates async to the main task.

from pyplot.jl.

stevengj avatar stevengj commented on June 19, 2024

Don't yield on every iteration of your inner loop. Just yield every 50ms or so.

from pyplot.jl.

bjarthur avatar bjarthur commented on June 19, 2024

@pyimport matplotlib.pyplot as plt to get non-interactive mode is quite useful for batch processing of data. would be great to have this documented. what "niceties" of PyPlot are lost by doing this?

from pyplot.jl.

stevengj avatar stevengj commented on June 19, 2024

@bjarthur, you lose the more Julian style of just typing plot (or PyPlot.plot) rather than having to qualify everything with plt., the LaTeXStrings import, the colormap conversions, some improved consistency of array-dimensionality handling, etc.

It should be straightforward to modify PyPlot to check the isinteractive() function to see if Julia is running in non-interactive mode, and if not then to initialize the pyplot module in non-interactive mode (skipping all of the GUI event-loop stuff), if anyone wants to take a crack at it.

from pyplot.jl.

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.