00001 import dataplot
00002 from pylab import *
00003
00004 class Plot(dataplot.GenericPlot):
00005 """Matplotlib plot.
00006
00007 The idea here is that each plot type is a subclass of Plot that
00008 defines a plot() method, which will be called with the kwargs
00009 given by the supplied callable data_fun.
00010
00011 """
00012 convert_to={
00013 'png':{'suffix':'.png'},
00014 'thumb':{'suffix':'-thumb.png','convert_args':'-resize 65x90'},
00015 'ps':{'suffix':'.ps'},
00016 }
00017 convert_from='ps'
00018
00019 def makefile(self):
00020 kwargs=self.get_plot_args()
00021 self.plot(**kwargs)
00022 savefig(self.from_filename())
00023
00024 class Scatter(Plot):
00025 """Simple matplotlib scatterplot.
00026
00027 """
00028
00029 def plot(self,x,y,main='',
00030 xlab='Label this with the "xlab" argument',
00031 ylab='Label this with the "ylab" argument',
00032 ):
00033 plot(x,y,'bo')
00034 title(main)
00035 xlabel(xlab)
00036 ylabel(ylab)
00037