Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. How do i go about embedding a matplotlib graph into Qt?
Servers for Qt installer are currently down

How do i go about embedding a matplotlib graph into Qt?

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 491 Views 1 Watching
  • 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.
  • X Offline
    X Offline
    xampierre
    wrote on 2 Oct 2020, 12:43 last edited by
    #1

    I have some matplotlib graphs i would like to embed in my app. When designing the window in QtDesigner i chose 2 Graphviews where i intend to display the graphs. How do i go about from here?

            with open("path") as graphFile:
                dataDict = json.load(graphFile)
    
            dataFrame = pandas.DataFrame.from_dict(dataDict, orient='index')
            dataFrame.plot(kind='bar')
    
            matplotlib.pyplot.show()
    

    Also, on a side note, i have 2 more issues i would like to solve:

    1. will the embeded graph keep the proportions of the window it's placed inside? I noticed that the default graph is square yet my window is rectangular and would like to fill all of it

    2. How can i make the graph interactive? Say hover over a value on X-axis and a small tool tip would appear with some extra details about that specific entry?

    Thanks

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 2 Oct 2020, 18:52 last edited by
      #2

      Hi,

      Matplotlib already provides Qt integration.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      1/2

      2 Oct 2020, 12:43

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved