Jupyter + Matplotlib > Warning:”matplotlib is currently using a non-GUI backend, ” > fig.show()

Action environment
GeForce GTX 1070 (8GB)
ASRock Z170M Pro4S [Intel Z170chipset]
Ubuntu 16.04 LTS desktop amd64
TensorFlow v1.1.0
cuDNN v5.1 for Linux
CUDA v8.0
Python 3.5.2
IPython 6.0.0 -- An enhanced Interactive Python.
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)

After changing the environment from Ubuntu 14.04 LTS to Ubuntu 16.04 LTS, the following Warning is displayed when drawing with Jupyter + Matplotlib.

/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py:403: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure
“matplotlib is currently using a non-GUI backend, “

% matplotlib  inline

# sine curve learning 
# Jul. 08, 2017

import numpy as np
import matplotlib.pyplot as plt

data1 = np.loadtxt('input.csv', delimiter=',')
#data2 = np.loadtxt('res.170708_0830.cut', delimiter=',')
data2 = np.loadtxt('res.170709_0900.cut', delimiter=',')

input1 = data1[:,0]
output1 = data1[:,1]
input2 = data2[:,0]
output2 = data2[:,1]

fig = plt.figure()
ax1 = fig.add_subplot(2,1,1)
ax2 = fig.add_subplot(2,1,2)

ax1.scatter(input1,output1)
ax2.scatter(input2,output2)

ax1.set_xlabel('x')
ax1.set_ylabel('sin(x)')
ax1.set_xlim([0,1.0])
ax1.grid(True)

ax2.set_xlabel('x')
ax2.set_ylabel('sin(x)')
ax2.set_xlim([0,1.0])
ax2.grid(True)

fig . show ()

Correspondence> fig.show () is unnecessary

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *