0

I built a small piece of code to plot some data.

I built it on my Oracle VirtualBox and it worked.

I moved it to production, and had the sys admin install the code and the libraries, etc.

Now the matplotlib.pyplot section is failing.

I tried a simple snippet

from matplotlib.pyplot import *
time = [0, 1, 2, 3]
position = [0, 100, 200, 300]
plt.plot(time, position)
plt.xlabel('Time (hr)')
plt.ylabel('Position (km)')

and get...

qt.qpa.screen: QXcbConnection: Could not connect to display

I don't even want to see this on the screen, I just want to create a png for a web site.

How can the code be re-written to connect to the display?

Marinaio
  • 111
  • 8

1 Answers1

1

take off the "plt." and it will work

from matplotlib.pyplot import *
time = [0, 1, 2, 3]
position = [0, 100, 200, 300]
plot(time, position)
xlabel('Time (hr)')
ylabel('Position (km)')
  • 1
    I copied your code snippet. Because no X I changed plot(time, position) to savefig('./books_read.png') and still get ^Cqt.qpa.screen: QXcbConnection: Could not connect to display – Marinaio Aug 08 '19 at 16:24