Quantcast
Channel: Active questions tagged windows-subsystem-for-linux - Ask Ubuntu
Viewing all articles
Browse latest Browse all 2930

Python 3 matplotlib does not display plot [duplicate]

$
0
0

I am using Microsoft Windows Subsystem for Linux (WSL), Ubuntu 18.04 and Python 3.6.7. When I execute this file from the command line, it does not display the plot. What is wrong?

# hello.py
import numpy as np
import matplotlib.pyplot as plt
t = np.linspace(0,np.pi,101)
x = np.sin(t)
fig,ax=plt.subplots(figsize=(9,3))
ax.plot(t,x)
ax.grid()
plt.tight_layout()
plt.show()

This code when executed from an Ubuntu terminal should display this plot, but it doesn't display it in WSL.

plot


Viewing all articles
Browse latest Browse all 2930

Trending Articles



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