Skip to content

Interactive plot of Matplotlib not working #2713

Discussion options

You must be logged in to vote

It looks like @ateixeira0163's reply solved your question @longhathuc
If not do not hesitate to reopen a discussion

I've wrote a little scene. Run this and see if it's what you want :

import Sofa
import Sofa.Gui
import SofaRuntime
import matplotlib.pyplot as plt

USE_GUI = True


def main():
    root = Sofa.Core.Node('root')
    createScene(root)
    Sofa.Simulation.init(root)
    plt.figure()

    if not USE_GUI:
        while root.getTime() < 5:  # This is done to be sure that the results will not explode
            Sofa.Simulation.animate(root, root.dt.value)
    else:
        Sofa.Gui.GUIManager.Init("myscene", "qglviewer")
        Sofa.Gui.GUIManager.createGUI(root, __file__)
        

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
5 replies
@longhathuc
Comment options

@ateixeira0163
Comment options

@longhathuc
Comment options

@ateixeira0163
Comment options

@hugtalbot
Comment options

Comment options

You must be logged in to vote
1 reply
@longhathuc
Comment options

Answer selected by hugtalbot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants