0

I have an object from a black box of type:

<matplotlib.axes._axes.Axes object at 0x7fedbe19c1d0>

I would like to plot it in a matplotlibwidget, in my pyqt5 GUI.

The problem is: How to plot my object in a specific figure?

I tried this:

myObject = blackBox() myObject_figure = myObject.get_figure() myObject_figure.show()

So here I can plot my <matplotlib.figure.Figure> object in a new figure, but I would like to plot it in a specific figure...

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Alex42
  • 21
  • 1
  • 3

1 Answers1

0

If I have understood your question correctly,you can use matplotlib.pyplot.subplot for the same. you can have a look at the examples in this link for starters https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplot.html

Shubham Jaiswal
  • 359
  • 1
  • 9
  • But the subplot doesn't help me to plot a figure object in a specific figure. – Alex42 May 25 '18 at 08:56
  • so you want to bind a figure object to to your pyqt5 GUI widget? Is this what you want? – Shubham Jaiswal May 25 '18 at 10:07
  • Hope this helps. https://stackoverflow.com/questions/12459811/how-to-embed-matplotlib-in-pyqt-for-dummies?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – Shubham Jaiswal May 25 '18 at 10:30
  • Excatly! I know how to embed matplotlib in pyqt. But I don't have any data to plot, I just have a matplotlib object... So how to plot a matplotlib object ? I can use, as I said, the show() method, but it create a new figure. I want to "show()" my object in my pyqt5 GUI. – Alex42 May 25 '18 at 10:50
  • have you tried the .get_xdata() and .get_ydata() methods – Shubham Jaiswal May 25 '18 at 11:24
  • Those methods doesn't exist – Alex42 May 25 '18 at 12:01
  • Do u mind sharing your code snippet of the black box() – Shubham Jaiswal May 25 '18 at 16:10
  • This is a link only answer that has only merit as long as the link exists. Please flesh out your answer so that is is stand-alone, and can help solve this problem even if the link is down. ... I think you get the idea... – Patrick Artner Jun 06 '18 at 05:11