Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 99124

Matplotlib error in VS Code for Mac Anaconda environment

$
0
0

I am working through the python tutorial for VS Code found at this link: https://code.visualstudio.com/docs/python/python-tutorial

At the bottom of the page is plotting example:

1  import matplotlib.pyplot as plt
2  import numpy as np
3  x = np.linspace(0, 20, 100) # Create a list of evenly-spaced numbers over the range
4  plt.plot(x, np.sin(x)) # Plot the sine of each x point
5  plt.show() # Display the plot

This does not produce any output within VS Code for Mac, but the same exact code works in a Jupyter notebook. I can see that the matplotlib packages are loaded into VS code in the variable window. If I put a break point at line 4, I get a strange error message in a separate window as I step into line 4:

Could not load source '<string>': Source unavailable.

I would like to get matplotlib working in VS Code. Any help is greatly appreciated!

Running Mac OS X 10.12.6, Anaconda Navigator 1.9.2, Python 3.6.5 from Anaconda, VS Code for Mac 1.32.2


Viewing all articles
Browse latest Browse all 99124

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>