0

I have installed Ubuntu 18 on Windows 10 using the Microsoft installation process, and been reasonably happy with its behavior. I have been developing small amounts of Python3 data analysis code using Pandas, Numpy, statistics, statsmodel. This has been working fine. I have been using Gnuplot to display some of the results. But, I want to shift to creating plots in Python on the fly. I have been using python 3.6, and tried 3.7 and 3.8 after I started having problems with pyplot.

I have not previously used pyplot. I do have experience with various other plotting contexts, including gnuplot, matlab, scilab, etc. I installed matplotlib using pip3 and also tried using apt-get, and then tried installing from the source. In each case I could get an error-message free install. But, the plot never showed on the screen. The following is the test code I have been using (mostly a piece of test code I copied from another website). I tried setting a default backend in the matplotlib config file, as well.

import matplotlib
from matplotlib import pyplot as plt
import numpy as np
import math

x = np.arange(0, math.pi*2, 0.05)
y = np.tan(x)

plt.plot(x,y)
plt.xlabel("angle")
plt.ylabel("Tan value")
plt.title('Tan wave')
plt.show()

input()
Parth Shah
  • 1,237
  • 10
  • 24
Bruce
  • 1
  • 1
  • Check [this](https://stackoverflow.com/questions/43397162/show-matplotlib-plots-in-ubuntu-windows-subsystem-for-linux-wsl1-wsl2) out. – Parth Shah Jul 28 '20 at 06:52
  • @ParthShah your comment was useful, and it got me through a couple of issues. I suspect that the linked question should be said to cover it. So, this is a duplicate. Although your second comment not so much - because I need to get dynamic display. For static png, I can just use Gnuplot, and would prefer to. – Bruce Jul 28 '20 at 09:18
  • @ParthShah I still have a problem but it is a different one, and I will work on that now. – Bruce Jul 28 '20 at 09:20
  • Both comments link to the same question. Feel free to close this question as it is a duplicate. – Parth Shah Jul 28 '20 at 09:28

0 Answers0