omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Matplotlib Graph in an ImageView

    Pythonista
    2
    3
    2298
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • filippocld223
      filippocld223 last edited by

      I want to put a matplotlib graph in a ImageView. How to do that?

      1 Reply Last reply Reply Quote 0
      • omz
        omz last edited by

        Save it to a file:

        import matplotlib.pyplot as plt
        plt.plot([1, 2, 3, 4])
        plt.savefig('temp.png')
        

        ...then load it into a ui.Image:

        import ui
        # ...
        img = ui.Image.named('temp.png')
        imageview.image = img
        
        1 Reply Last reply Reply Quote 0
        • filippocld223
          filippocld223 last edited by

          Thanks. now I have made a "Plotter" with ui module and matplotlib 😃

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors