Forum Archive

Matplotlib Graph in an ImageView

filippocld223

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

omz

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
filippocld223

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