matplot to view
I have a matplot view being output to the console. How would I adjust my code to output it to a new view instead?
The first bit of code is how the plot is going to the console.
The second is the view I want the plot to be in.
plt.plot(x, y) plt.title('Amplitude Vs Time') plt.show()
view = ui.View() view.background_color = 'white' view.present('sheet')
Something like this should work:
from matplotlib import pyplot as plt import ui plt.plot([1, 2, 4, 2]) plt.savefig('plot.png') img_view = ui.ImageView() img_view.frame = (0, 0, 500, 500) img_view.content_mode = ui.CONTENT_SCALE_ASPECT_FIT img_view.image = ui.Image.named('plot.png') img_view.present('sheet')
This post is deleted!last edited by