Here is some additional information regarding this problem
OS -- Linux 2.6.22-16-generic #1 SMP Mon Jan 26 00:07:52 GMT 2009 i686
GNU/Linux
Moved matplotlibrc to "os.environ['HOME'] = '/tmp/matlibconfig'" because
of write permission problems with apache child processes.
No customizations to matplotlibrc
Ubuntu Gutsy
Python-matplotlib 0.90.1-2ubuntu1
Python-matplotlib-data 0.90.1-2ubuntu1
Python-matplotlib-doc 0.90.1-2ubuntu1
Code
# This code is called by another python script
# and I am not even using the parameters that
# are passed
# Code works from python idle
import sys, math
import matplotlib_config_path # this sets configpath as described above
import matplotlib
matplotlib.use('Agg') # use non gui backend
from matplotlib import pylab as plt
import numpy as np
import os,sys
def VT(batt_v, batt_temp0, batt_temp1, batt_ts, plotfile, dur):
t =
for x in batt_ts: # time axis to 0 based
t.append((x - batt_ts[0])/divsor[dur])
fig = plt.figure()
ax1 = fig.add_subplot(111) # subplot 1 col x 1 row
ax1.plot([1,2,3])
fig.savefig('test.png')
Error returned is the same
rlp_GMC wrote:
···
When I try to save a fig to a file I get the error
TclError Couldn't Connect to display ":0.0"
I looked in the Maplotlib users manual (latest version pg 144-146) and
tried the following with no luck. BTW why is the same module named
differently Linux/Win ?
import matplotlib
matplotlib.use('Agg')
import matplotlib.pylab as plt (linux ) or, import matplotlib.pyplot as
plt (Windows)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot([1,2,3])
fig.savefig('test.png')
Is Matplotlib trying to display a plot to the monitor?
rlp
--
View this message in context: http://www.nabble.com/TclError-Couldn't-Connect-to-display-"%3A0.0"-tp22176192p22207062.html
Sent from the matplotlib - users mailing list archive at Nabble.com.