コード例 #1
0
ファイル: plots.py プロジェクト: sdiehl/rpygtk
    def plot(self,event,image=None):
        _xlab,_ylab,_title,_xmin,_ymin,_xmax,_ymax = self.fetch_labels()

        data = self.data

        args = rdict({'xlab':_xlab,
                    'ylab':_ylab,
                    'main':_title
                    })

        if _xmin and _xmax:
            args['xlim']=rsession.translate_to_vector([_xmin,_xmax])

        if _ymin and _ymax:
            args['ylim']=rsession.translate_to_vector([_ymin,_ymax])

        args['col'] = self.get_fill_color()
        args['bty'] = self.get_frame_style()
        args['pch'] = self.get_point_style()

        plotwindow = rsession.RPlotThread(data=data,
                                            args=args,
                                            type='boxplot',
                                            export=image)
        plotwindow.start()
        self.active_threads.append(plotwindow)
コード例 #2
0
ファイル: plots.py プロジェクト: sdiehl/rpygtk
    def plot(self,event,image=None):
        _xlab,_ylab,_title,_xmin,_ymin,_xmax,_ymax = self.fetch_labels()

        data = {'x':self.x}

        args = rdict({'xlab':_xlab,
                      'ylab':_ylab,
                      'main':_title
                     })

        if _xmin and _xmax:
            args['xlim']=rsession.translate_to_vector([_xmin,_xmax])

        if _ymin and _ymax:
            args['ylim']=rsession.translate_to_vector([_ymin,_ymax])

        plotwindow = rsession.RPlotThread(data=data,
                                        args=args,
                                        type='bar',
                                        export=image)

        args['col'] = self.get_fill_color()
        args['density'] = self.parameters['Fill Density'].get()

        plotwindow.start()
        self.active_threads.append(plotwindow)
コード例 #3
0
ファイル: plots.py プロジェクト: sdiehl/rpygtk
    def plot(self,event,image=None):
        _xlab,_ylab,_title,_xmin,_ymin,_xmax,_ymax = self.fetch_labels()

        data = {'x':self.x}

        args = rdict({'xlab':_xlab,
                    'ylab':_ylab,
                    'main':_title
                    })

        if _xmin and _xmax:
            args['xlim']=rsession.translate_to_vector([_xmin,_xmax])

        if _ymin and _ymax:
            args['ylim']=rsession.translate_to_vector([_ymin,_ymax])

        #One or the other
        args['breaks'] = self.parameters['Bin Algorithm'].get()
        if self.parameters['Number of Bins']:
            args['breaks'] = self.parameters['Number of Bins'].get()

        args['col'] = self.get_fill_color()
        args['density'] = self.parameters['Fill Density'].get()
        args['freq'] = self.parameters['Frequency'].get()
        args['labels'] = self.parameters['Count Labels'].get()

        plotwindow = rsession.RPlotThread(data=data,
                                        args=args,
                                        type='histogram',
                                        export=image)

        plotwindow.start()
        self.active_threads.append(plotwindow)
コード例 #4
0
ファイル: plots.py プロジェクト: sdiehl/rpygtk
    def plot(self,event,image=None):

        _xlab,_ylab,_title,_xmin,_ymin,_xmax,_ymax = self.fetch_labels()

        data = {'x':self.x,
                'y':self.y}

        #We use an rdict so that any keys with empty values get thrown out and avoid conflicts with R
        args = rdict({'xlab':_xlab,
                    'ylab':_ylab,
                    'main':_title,
                    })

        if _xmin and _xmax:
            args['xlim']=rsession.translate_to_vector([_xmin,_xmax])

        if _ymin and _ymax:
            args['ylim']=rsession.translate_to_vector([_ymin,_ymax])

        #Normal Parameters
        args['asp'] = self.parameters['Aspect Ratio'].get()
        args['col'] = self.get_point_color()
        args['bty'] = self.get_frame_style()
        #R takes the first character of the type as an argument i.e 'o' = overplot
        args['type'] = self.parameters['Type'].get()[0].lower()
        args['pch'] = self.get_point_style()
        args['lty'] = self.get_line_style()+1

        plotwindow = rsession.RPlotThread(data=data,
                                        args=args,
                                        type='scatter',
                                        export=image)

        plotwindow.start()
        self.active_threads.append(plotwindow)
コード例 #5
0
ファイル: plots.py プロジェクト: sdiehl/rpygtk
    def plot(self,event,image=None):
        _xlab,_ylab,_title,_xmin,_ymin,_xmax,_ymax = self.fetch_labels()

        data = {'x':self.x,
                'y':self.y}

        args = rdict({'xlab':_xlab,
                    'ylab':_ylab,
                    'main':_title
                    })

        if _xmin and _xmax:
            args['xlim']=rsession.translate_to_vector([_xmin,_xmax])

        if _ymin and _ymax:
            args['ylim']=rsession.translate_to_vector([_ymin,_ymax])

        args['col'] = self.get_point_color()
        args['bty'] = self.get_frame_style()
        args['pch'] = self.get_point_style()

        if self.x and self.y:
            plotwindow = rsession.RPlotThread(data=data,
                                            args=args,
                                            type='qqplot',
                                            export=image)
        elif self.x:
            #info('qnorm')
            plotwindow = rsession.RPlotThread(data=data,
                                type='qqnorm',
                                export=image)
        else:
            error('Required variables are not set.')
            return

        plotwindow.start()
        self.active_threads.append(plotwindow)

        if self.parameters['Show Line'].get():
            plotwindow.add_cmd(rsession.r['qqline'],self.x,col=self.get_line_color(),lty=self.get_line_style())
コード例 #6
0
ファイル: plots.py プロジェクト: sdiehl/rpygtk
    def plot(self,event,image=None):
        _xlab,_ylab,_title,_xmin,_ymin,_xmax,_ymax = self.fetch_labels()

        data = {'x':self.x}

        args = rdict({'xlab':_xlab,
                    'ylab':_ylab,
                    'main':_title
                    })

        #Normal Parameters
        args['radius'] = self.parameters['Radius'].get()
        args['edges'] = self.parameters['Polygon Edges'].get()
        args['density'] = self.parameters['Fill Density'].get()
        args['clockwise'] = self.parameters['Clockwise'].get()
        args['init.angle'] = self.parameters['Initial Angle'].get()

        #Ask the user to confirm that they want to plot copious amounts of data
        if len(data['x'])>30:
            if not wrappers.yesNoDialog('There is a very large amount of datapoints to graph, this make take a very time or even crash, are you sure you want to continue?'):
                return
        elif len(data['x'])>200:
            error('Too many data points for pie plot')
            return

        if self.fill_style.get_active_text() == 'Rainbow':
            args['col']=rsession.r['rainbow'](len(data['x']))
        if self.fill_style.get_active_text() == 'Gray':
            #Make shades of gray
            shades = map(lambda x:x/(len(data['x'])+1.0),range(0,len(data['x'])))
            args['col']=rsession.r['gray'](shades)

        plotwindow = rsession.RPlotThread(data=data,
                                        args=args,
                                        type='pie',
                                        export=image)

        plotwindow.start()
        self.active_threads.append(plotwindow)
コード例 #7
0
ファイル: plots.py プロジェクト: sdiehl/rpygtk
    def plot(self,event,image=None):
        _xlab,_ylab,_title,_xmin,_ymin,_xmax,_ymax = self.fetch_labels()

        data = self.data

        args = rdict()

        if self.parameters['Lower Panels'].get():
            args['lower.panel'] = rsession.r('panel.smooth')
        else:
            args['lower.panel'] = rsession.null

        args['gap'] = self.parameters['Plot Gap'].get()
        args['pch'] = self.get_point_style()

        #Advanced Parameters

        plotwindow = rsession.RPlotThread(data=data,
                                        args=args,
                                        type='matplot',
                                        export=image)

        plotwindow.start()
        self.active_threads.append(plotwindow)