diff --git a/src/graph/app.py b/src/graph/app.py new file mode 100644 --- /dev/null +++ b/src/graph/app.py @@ -0,0 +1,47 @@ +from zope.interface import Interface +from zope.interface import implements + +from graph.components import BaseComponent, Image +from graph.interfaces import IAxis, IViewBox + + +class IPlotImage(Interface): + """ + Componante to plot a 2d graph of a given image + """ + + +class PlotImage( BaseComponent): + """ + Makes a 2D plot for an image + """ + implements(IPlotImage) + + def __init__(self, parent, image): + super(PlotImage, self).__init__(parent) + self.image = image + self.x_axis = IAxis(self) + self.x_axis.orientation='bottom' + self.x_axis.start=0 + self.x_axis.end=8 + + self.y_axis = IAxis(self) + self.y_axis.orientation='left' + self.y_axis.start=-5 + self.y_axis.end=3 + + self.vb = IViewBox(self) + + self.vb.addItem( self.x_axis ) + self.vb.addItem( self.y_axis ) + self.vb.addItem( self.image ) + + def render(self): + return self.vb.render() + + + +image = Image(None, None) +plot = PlotImage( None, image) +print( plot.render()) +