コード例 #1
0
 def _test2(self):
   ip = IrregPlot('../dsm2-input-files/irregular_xsects/6_0.62089.txt')
   pl = ip.getPlot()
   from vista.graph import Graph, MultiPlot, AxisAttr
   from vista.app import DataGraphFrame
   graph = Graph()
   graph.add(pl)
   dg = DataGraphFrame(graph,'',1)
コード例 #2
0
def show_plot(plot):
    graph = Graph()
    graph.add(plot)
    graph.setTitle("")
    dg = DataGraphFrame(graph,'',0)
    dg.setLocation(100,100)
    dg.setVisible(1)
    dg.setSize(600,400)
    return dg
コード例 #3
0
def simple_plot(x,y,
                xlabel="x axis", ylabel="y axis", title = "title",
                legend = "legend",
                color = "red", symbol = None, gridy = 1, gridx = 0):
    """
    uses vista's graphing capabilities to draw a simple line
    plot between x and y 
    """
    pl = xyplot(x,y,xlabel,ylabel,title,legend,color,symbol,gridy,gridx)
    graph = Graph()
    graph.add(pl)
    graph.setTitle("")
    dg = DataGraphFrame(graph,'',0)
    dg.setLocation(100,100)
    dg.setVisible(1)
    dg.setSize(600,400)
    return pl
コード例 #4
0
def show_plot(plot):
    graph = Graph()
    graph.add(plot)
    graph.setTitle("")
    dg = DataGraphFrame(graph, '', 0)
    dg.setLocation(100, 100)
    dg.setVisible(1)
    dg.setSize(600, 400)
    return dg
コード例 #5
0
def simple_plot(x,
                y,
                xlabel="x axis",
                ylabel="y axis",
                title="title",
                legend="legend",
                color="red",
                symbol=None,
                gridy=1,
                gridx=0):
    """
    uses vista's graphing capabilities to draw a simple line
    plot between x and y 
    """
    pl = xyplot(x, y, xlabel, ylabel, title, legend, color, symbol, gridy,
                gridx)
    graph = Graph()
    graph.add(pl)
    graph.setTitle("")
    dg = DataGraphFrame(graph, '', 0)
    dg.setLocation(100, 100)
    dg.setVisible(1)
    dg.setSize(600, 400)
    return pl
コード例 #6
0
 def plot(self,channel,type='XSection'):
   """
   """
   chan_keys = []
   for key in self.all_keys:
     if channel == string.split(key,'_')[0]:
       chan_keys.append(key)
       irreg_plots = 1
   if len(chan_keys) == 0 :
     print 'No irregular geometry found for ' + channel
     # look for regular x sect geom
     try:
       xsect1 = self.dsm2_data.channels[channel].data['xsect1']
       xsect1 = self.dsm2_data.xsects[xsect1]
       dist1 =  self.dsm2_data.channels[channel].data['dist1']
       xsect2 = self.dsm2_data.channels[channel].data['xsect2']
       xsect2 = self.dsm2_data.xsects[xsect2]
       dist2 =  self.dsm2_data.channels[channel].data['dist2']
       irreg_plots = 0
     except KeyError:
       print 'No channel: ' + channel + ' exists!'
       return
   #
   plots = []
   if irreg_plots:
     for key in chan_keys :
       irreg_file = string.lower(self.irreg_geom[key].data['FILENAME'])
       ip = IrregPlot(irreg_file)
       plots.append(ip.getPlot(type))
   else:
     ip1 = RegPlot(channel,xsect1,dist1)
     ip2 = RegPlot(channel,xsect2,dist2)
     plots.append(ip1.getPlot())
     plots.append(ip2.getPlot())
   #
   from vista.graph import Graph, MultiPlot, AxisAttr
   from vista.app import DataGraphFrame
   graph = Graph()
   mp = MultiPlot(len(plots),1)
   lx = plots[0].getAxis(AxisAttr.LEFT)
   bx = plots[0].getAxis(AxisAttr.BOTTOM)
   lx_range = [lx.getScale().getDataMinimum(),lx.getScale().getDataMaximum()]
   bx_range = [bx.getScale().getDataMinimum(),bx.getScale().getDataMaximum()]
   #
   for pl in plots:
     mp.add(pl)
     lx = pl.getAxis(AxisAttr.LEFT)
     bx = pl.getAxis(AxisAttr.BOTTOM)
     lx_range[0] = min(lx.getScale().getDataMinimum(),lx_range[0])
     bx_range[0] = min(bx.getScale().getDataMinimum(),bx_range[0])
     lx_range[1] = max(lx.getScale().getDataMaximum(),lx_range[1])
     bx_range[1] = max(bx.getScale().getDataMaximum(),bx_range[1])
   #
   for pl in plots:
     lx = pl.getAxis(AxisAttr.LEFT)
     lx.setDCRange(lx_range[0],lx_range[1])
     bx = pl.getAxis(AxisAttr.BOTTOM)
     bx.setDCRange(bx_range[0],bx_range[1])
   graph.add(mp)
   if irreg_plots:
     graph.setTitle("Irreg XSects for " + channel)
   else:
     graph.setTitle("Regular XSects for " + channel)
   dg = DataGraphFrame(graph,channel,0)
   dg.setLocation(100,100)
   dg.setVisible(1)