I am having problems with matplotlib, Sage plotting and, apparently, backends. I have installed Sage 6.2 on my Mac Book Pro (system 10.6) (I just upgraded from Sage 4.2). I have removed all copies of matplotlibrc from my computer except for the file buried in Sage-6.2/.../mpl_data/. All choices of backend resulted in the errors: _backend not found, where _backend is the name of the library that should load for the backend (e.g. _tkagg for TKAgg). My partial solution is to use the _tkagg from my prior Sage version which I produced by a compile many years ago before I had Sage.
I have tried several scenarios to run my code: iPython (in Terminal), Sage (in Terminal), and as a script. Scripts and iPython are run through the Sage 6.2 package. I mostly run from script which has the most problems. The most successful situation is with TKAgg. However, calling plot(...) and show() from pylab and D.show() from Sage (where D is a graph) have different successes. Here is a table of what does and does not work (view with monospace font).
Backend Plot
call iPython
Sage Script
TKAgg D.show() Yes Yes No (but Preview does launch)
pylab.plot() Yes Yes Yes
No
Backend D.show() Yes Yes No (but Preview does launch)
pylab.plot() No No No
No Backend means I commented out the backend statement in matplotlibrc.
TKAgg is the most successful, but not fully. And I had to add the _tkagg library to the
Sage package.
Sorry for the verbose post, but I thought I'd try several
things, first. I did see a previous post about some bug in Sage 6.2 using the
wrong .matplotlib folder, but I don't know what that tells me.
I can limp along with what I have above, but any help very
appreciated.
--------------------------------
Code generating problems:
(1) D.show() version:
adjls=[[0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1,
0]]
M= Matrix(adjls)
D= Graph(M)
D.show()
(2) pylab.plot version:
import numpy as NP
import pylab as PL
x= NP.array([1,2,3,4])
y= x**2
PL.plot(x,y)