Server IP : 127.0.0.2 / Your IP : 18.227.89.143 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/lib/python2.7/dist-packages/pychart/ |
Upload File : |
# # Copyright (C) 2000-2005 by Yasushi Saito (yasushi.saito@gmail.com) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # import tick_mark import line_style import pychart_util import chart_object import fill_style import types import error_bar_doc import object_set from pychart_types import * __doc__ = """Pychart offers several styles of error bars. Some of them only displays the min/max confidence interval, while others can display quartiles in addition to min/max.""" class T(chart_object.T): keys = {} ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED pass # Two horizontal lines at min & max locations. class error_bar1(T): __doc__ = error_bar_doc.doc_1 keys = {"tic_len" : (UnitType, 10, "Length of the horizontal bars"), "line_style": (line_style.T, line_style.default, "") } ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def draw(self, can, loc, min, max, qmin = None, qmax = None): x = loc[0] y = min can.line(self.line_style, x-self.tic_len/2.0, y, x+self.tic_len/2.0, y) y = max can.line(self.line_style, x-self.tic_len/2.0, y, x+self.tic_len/2.0, y) class error_bar2(T): __doc__ = error_bar_doc.doc_2 keys = {"tic_len" : (UnitType, 3, "The length of the horizontal bars"), "hline_style": (line_style.T, line_style.default, "The style of the horizontal bars."), "vline_style": (line_style.T, None, "The style of the vertical bar.") } ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def draw(self, can, loc, min, max, qmin = None, qmax = None): vline_style = self.vline_style if not vline_style: vline_style = self.hline_style x = loc[0] y1 = min can.line(self.hline_style, x-self.tic_len/2.0, y1, x+self.tic_len/2.0, y1) y2 = max can.line(self.hline_style, x-self.tic_len/2.0, y2, x+self.tic_len/2.0, y2) can.line(vline_style, x, y1, x, y2) class error_bar3(T): # Tufte style __doc__ = "This style is endorsed by the Tufte's books. " \ + error_bar_doc.doc_3 keys = { "line_style": (line_style.T, line_style.default, "") } ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def draw(self, can, loc, min, max, qmin, qmax): x = loc[0] can.line(self.line_style, x, min, x, qmin) can.line(self.line_style, x, qmax, x, max) class error_bar4(T): __doc__ = error_bar_doc.doc_4 keys = { "line_style": (line_style.T, line_style.default, ""), "fill_style": (fill_style.T, fill_style.gray70, ""), "box_width": (UnitType, 4, ""), "tic_len": (UnitType, 4, "") } ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def draw(self, can, loc, min, max, qmin, qmax): x = loc[0] style = self.line_style y1 = min can.line(style, x-self.tic_len/2.0, y1, x+self.tic_len/2.0, y1) y2 = max can.line(style, x-self.tic_len/2.0, y2, x+self.tic_len/2.0, y2) can.line(style, x, y1, x, y2) can.rectangle(style, self.fill_style, x-self.box_width/2.0, qmin, x+self.box_width/2.0, qmax) # vertical line class error_bar5(T): __doc__ = error_bar_doc.doc_5 keys = { "line_style": (line_style.T, line_style.default, "") } ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def draw(self, can, loc, min, max, qmin = None, qmax = None): x = loc[0] y = loc[1] min = (min - y) *1 + y max = (max - y) *1+ y can.line(self.line_style, x, min, x, max) # a box class error_bar6(T): __doc__ = error_bar_doc.doc_6 keys = { "line_style": (line_style.T, line_style.default, ""), "fill_style": (fill_style.T, fill_style.gray70, ""), "center_line_style": (line_style.T, line_style.T(width=0.5), ""), "box_width": (UnitType, 4, ""), } ##AUTOMATICALLY GENERATED ##END AUTOMATICALLY GENERATED def draw(self, can, loc, min, max, qmin = None, qmax = None): x = loc[0] y = loc[1] can.rectangle(self.line_style, self.fill_style, x - self.box_width / 2.0, min, x + self.box_width / 2.0, max) can.line(self.center_line_style, x - self.box_width/2.0, (min+max)/2.0, x + self.box_width/2.0, (min+max)/2.0) bar1 = error_bar1() bar2 = error_bar2() bar3 = error_bar3() bar4 = error_bar4() bar5 = error_bar5() bar6 = error_bar6() standards = object_set.T(bar1, bar2, bar3, bar4, bar5, bar6)