Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

matplotlib plotting with python in xcode

I am trying to run python in XCode. The following simple plotting routine,

import matplotlib.pyplot as pyplot
pyplot.plot((0,1),(1,2))
pyplot.show()

returns no errors. XCode seems pretty happy with what it accomplishes when I hit the run button. But I get no plot window whatsoever, as far as I can tell. Is it hiding somewhere or what? How do I get to see it?

like image 359
bob.sacamento Avatar asked Mar 08 '26 00:03

bob.sacamento


1 Answers

xcode will allow you to see plots if you move your code into an interactive notebook.

  • create a new file with the .ipynb file extension
  • copy your code into that file

You should be able not only to see the plots but also any other output your code is trying to send to the UI.

enter image description here

like image 120
luismesas Avatar answered Mar 10 '26 14:03

luismesas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!