import dataplot,pdb
try:
import matplotlib
matplotlib.use('agg')
from pylab import *
ERROR_MESSAGE=''
except ImportError:
ERROR_MESSAGE='pylab module unavailable. To view this plot, please install matplotlib'
class Plot(dataplot.GenericPlot):
"""Matplotlib plot.
The idea here is that each plot type is a subclass of Plot that
defines a plot() method, which will be called with the kwargs
given by the supplied callable data_fun.
"""
convert_to={
'web':{'suffix':'.png'},
'thumb':{'suffix':'-thumb.png','size':(65,90)},
}
convert_from='web'
ERROR_MESSAGE=ERROR_MESSAGE
def makefile(self):
print self
pdb.set_trace()
kwargs=self.get_plot_args()
self.plot(**kwargs)
savefig(self.from_filename())
class Scatter(Plot):
"""Simple matplotlib scatterplot.
"""
def plot(self,x,y,main='',
xlab='Label this with the "xlab" argument',
ylab='Label this with the "ylab" argument',
):
plot(x,y,'bo')
title(main)
xlabel(xlab)
ylabel(ylab)