• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pyplot.table函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中matplotlib.pyplot.table函数的典型用法代码示例。如果您正苦于以下问题:Python table函数的具体用法?Python table怎么用?Python table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了table函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_zorder

def test_zorder():
    data = [[66386, 174296],
            [58230, 381139]]

    colLabels = ('Freeze', 'Wind')
    rowLabels = ['%d year' % x for x in (100, 50)]

    cellText = []
    yoff = np.zeros(len(colLabels))
    for row in reversed(data):
        yoff += row
        cellText.append(['%1.1f' % (x/1000.0) for x in yoff])

    t = np.linspace(0, 2*np.pi, 100)
    plt.plot(t, np.cos(t), lw=4, zorder=2)

    plt.table(cellText=cellText,
              rowLabels=rowLabels,
              colLabels=colLabels,
              loc='center',
              zorder=-2,
              )

    plt.table(cellText=cellText,
              rowLabels=rowLabels,
              colLabels=colLabels,
              loc='upper center',
              zorder=4,
              )
    plt.yticks([])
开发者ID:adnanb59,项目名称:matplotlib,代码行数:30,代码来源:test_table.py


示例2: test_bbox_inches_tight

def test_bbox_inches_tight():
    #: Test that a figure saved using bbox_inches='tight' is clipped correctly
    data = [[66386, 174296, 75131, 577908, 32015],
            [58230, 381139, 78045, 99308, 160454],
            [89135, 80552, 152558, 497981, 603535],
            [78415, 81858, 150656, 193263, 69638],
            [139361, 331509, 343164, 781380, 52269]]

    colLabels = rowLabels = [''] * 5

    rows = len(data)
    ind = np.arange(len(colLabels)) + 0.3  # the x locations for the groups
    cellText = []
    width = 0.4     # the width of the bars
    yoff = np.zeros(len(colLabels))
    # the bottom values for stacked bar chart
    fig, ax = plt.subplots(1, 1)
    for row in range(rows):
        ax.bar(ind, data[row], width, bottom=yoff, align='edge', color='b')
        yoff = yoff + data[row]
        cellText.append([''])
    plt.xticks([])
    plt.xlim(0, 5)
    plt.legend([''] * 5, loc=(1.2, 0.2))
    # Add a table at the bottom of the axes
    cellText.reverse()
    plt.table(cellText=cellText, rowLabels=rowLabels, colLabels=colLabels,
              loc='bottom')
开发者ID:QuLogic,项目名称:matplotlib,代码行数:28,代码来源:test_bbox_tight.py


示例3: plot

  def plot(self):
    # Read events.
    #self.read_simple_events()
    #self.read_external_events()
    self.read_events()
    self.scale(self.scale_factor)
    
    # Set the plot size.
    grid_row = 2
    grid_fig_col = self.num_simple_events / 2
    grid_legend_col = 8
    grid_col = grid_fig_col + grid_legend_col
    fig = plt.figure(figsize = (grid_col, grid_row * 6))

    # Plot simple events.
    plt.subplot2grid((grid_row, grid_col), (0, 0), colspan = grid_fig_col)
    x = np.arange(self.num_simple_events)
    # Prepare colors.
    colors = self.get_colors(len(V8_STATES_PLOT))
    plt.stackplot(x, [self.data[key] for key in V8_STATES_PLOT], colors = colors)
    # Set the axis limits.
    plt.xlim(xmin = 0, xmax = self.num_simple_events - 1)
    plt.ylim(ymin = 0, ymax = self.sampling_period)
    # Draw legend.
    plt.subplot2grid((grid_row, grid_col), (0, grid_col - 1))
    total_ticks = self.num_simple_events * self.sampling_period
    plt.table(cellText = [[str(100 * sum(self.data[key]) / total_ticks) + ' %'] for key in reversed(V8_STATES_PLOT)],
              rowLabels = V8_STATES_PLOT[::-1],
              rowColours = colors[::-1],
              colLabels = ['Ticks'],
              loc = 'center')
    plt.xticks([])
    plt.yticks([])
    
    # Plot external events.
    plt.subplot2grid((grid_row, grid_col), (1, 0), colspan = grid_fig_col)
    x = np.arange(self.num_external_events)
    # Prepare colors.
    colors = self.get_colors(len(EXTERNAL_DETAILS))
    plt.stackplot(x, [self.data_external[key] for key in EXTERNAL_DETAILS], colors = colors)
    # Set the axis limits.
    plt.xlim(xmin = 0, xmax = self.num_external_events - 1)
    plt.ylim(ymin = 0, ymax = self.sampling_period)
    # Draw legend.
    plt.subplot2grid((grid_row, grid_col), (1, grid_col - 3), colspan = 3)
    total_ticks = 0
    for key in EXTERNAL_DETAILS:
      total_ticks += sum(self.data_external[key]) + 1
    plt.table(cellText = [[str(100 * sum(self.data_external[key]) / total_ticks) + ' %', str(sum(self.num_external[key]))] for key in reversed(EXTERNAL_DETAILS)],
              rowLabels = EXTERNAL_DETAILS[::-1],
              rowColours = colors[::-1],
              colLabels = ['Ticks', '# of Times'],
              loc = 'center')
    plt.xticks([])
    plt.yticks([])
    
    # Finally draw the plot.
    plt.tight_layout()
    plt.show()
开发者ID:jray319,项目名称:v8_simulation,代码行数:59,代码来源:plot.py


示例4: plotTable

		def plotTable(inData):
			fig = plt.figure(figsize=(10,5))
			plt.axis('off')
			plt.tight_layout()
			plt.table(cellText=[row for row in inData[1:]],
				loc = 'center',
				rowLabels = range(len(inData)-1),
				colLabels = inData[0])
开发者ID:AccelerateAnalyticsAdmin,项目名称:omf,代码行数:8,代码来源:cvrStatic.py


示例5: plotTable

	def plotTable(inData):
		fig = plt.figure(figsize=(20,10))
		plt.axis('off')
		plt.tight_layout()
		plt.table(cellText=[row[1:] for row in inData[1:]], 
			loc = 'center',
			rowLabels = [row[0] for row in inData[1:]],
			colLabels = inData[0])
开发者ID:acmbc68,项目名称:omf,代码行数:8,代码来源:staticCvrAnalysis.py


示例6: reportwin

def reportwin(namel,report,reportl):
    save_report=open(str(direktorij+'/report.tex'),'w')
    save_report.write(report)
    save_report.close()
    plt.figure(figsize=(4,3))
    ax=plt.gca()
    plt.axis('off')
    plt.table(cellText=reportl, colLabels=namel,loc='center')
    plt.savefig(str(direktorij+'/report.png'))
    plt.close()
开发者ID:KrTis,项目名称:Astro-utilities,代码行数:10,代码来源:MDA2.py


示例7: visualize_clf

def visualize_clf(file_path):
	ext_pattern = "14"
	int_pattern = "23"
	path = "{}/**/*{}*.p".format(file_path,ext_pattern)
	
	files = glob(path)
	print files
	thresholds = np.arange(0.65,1,0.05)
	file_dict = dict()
	for f in files:
		filename = f[f.rfind('/')+1:]
		sub = filename[:filename.find('_')]
		pair = (f,f.replace(ext_pattern,int_pattern))
		print pair
		if sub in file_dict:
			file_dict[sub].append(pair) 
		else:
			file_dict[sub]=[pair]
	print file_dict
	for sub,file_list in file_dict.iteritems():
		fig = plt.figure()	
		cell_text = []
		col_labels= []
		file_list = sorted(file_list)
		for i,pair in enumerate(file_list):
			print pair
			f = pair[0]
			sl = pickle.load(open(f,'rb'))
			data = sl.samples[0]
			fig.add_subplot(4,4,i+1)
			title = f[f.find('-')+1:]
			plt.title(title)
			col_labels.append(title)
			plt.hist(data)
			coltext = []
			print title
			for thr in thresholds:
			    data_3d = sl.a.mapper.reverse1(sl.samples)[0]
			    cluster_map, n_clusters = ndimage.label(data_3d > thr)
			    cluster_sizes = np.bincount(cluster_map.ravel())[1:]
			    if len(cluster_sizes) != 0:
			        coltext.append("{}".format(np.max(cluster_sizes)))
			    else:
				coltext.append(0)
			cell_text.append(coltext)
		ax = fig.add_subplot(4,4,len(files)+2)
		ax.axis('off')
		print len(cell_text)
		plt.table(cellText= cell_text,rowLabels=col_labels, 
				colLabels=thresholds,loc='center right')
		plt.savefig('{}.png'.format(sub))
开发者ID:ronimaimon,项目名称:mvpa_analysis,代码行数:51,代码来源:visualize_clf.py


示例8: test_bbox_inches_tight

def test_bbox_inches_tight():
    "Test that a figure saved using bbox_inches'tight' is clipped right"
    rcParams.update(rcParamsDefault)

    data = [[  66386,  174296,   75131,  577908,   32015],
            [  58230,  381139,   78045,   99308,  160454],
            [  89135,   80552,  152558,  497981,  603535],
            [  78415,   81858,  150656,  193263,   69638],
            [ 139361,  331509,  343164,  781380,   52269]]

    colLabels = ('Freeze', 'Wind', 'Flood', 'Quake', 'Hail')
    rowLabels = ['%d year' % x for x in (100, 50, 20, 10, 5)]

    rows = len(data)
    ind = np.arange(len(colLabels)) + 0.3  # the x locations for the groups
    cellText = []
    width = 0.4     # the width of the bars
    yoff = np.array([0.0] * len(colLabels))
    # the bottom values for stacked bar chart
    fig, ax = plt.subplots(1,1)
    for row in xrange(rows):
        plt.bar(ind, data[row], width, bottom=yoff)
        yoff = yoff + data[row]
        cellText.append(['%1.1f' % (x/1000.0) for x in yoff])
    plt.xticks([])
    plt.legend(['1', '2', '3', '4', '5'], loc = (1.2, 0.2))
    # Add a table at the bottom of the axes
    cellText.reverse()
    the_table = plt.table(cellText=cellText,
                          rowLabels=rowLabels,
                          colLabels=colLabels, loc='bottom')
开发者ID:AmitAronovitch,项目名称:matplotlib,代码行数:31,代码来源:test_bbox_tight.py


示例9: main

def main():
    tables = []
    fh = open(args.input_file, "r")
    for row in csv.reader(fh, delimiter='\t'):
        if (row[2] != "sRNA") and (row[0] == "group_28"):
            datas = row[3].split(";")
            gos = []
            for data in datas:
                gos.append(data.split("(")[0])
            tables.append([row[1], row[2]])
    plt.figure(figsize=(25, 10))
    columns = ["name", "number"]
    plt.table(cellText=tables,
              colLabels=columns,
              loc='bottom')
    plt.savefig("test.png")    
开发者ID:Sung-Huan,项目名称:run_clustering,代码行数:16,代码来源:plot_table.py


示例10: output_table

def output_table(celltext,title,col_labels,filename,fig_size,pos_y,col_width):
    prop = matplotlib.font_manager.FontProperties(fname=r'MTLmr3m.ttf', size=14.5)

    fig=plt.figure(figsize=fig_size)
    ax = fig.add_subplot(111)

    ax.set_title(title,y=pos_y,fontproperties=prop)
    ax.xaxis.set_visible(False)
    ax.yaxis.set_visible(False)
    for sp in ax.spines.itervalues():
        sp.set_color('w')
        sp.set_zorder(0)
    #col_labels = ['Rank','Name', 'Yell','Lv.']

    the_table = plt.table(cellText=celltext,
                          colLabels=col_labels,
                          loc='center'
                          )

    cells = the_table.get_celld()
    for i in range(len(celltext)+1): #0.09,0.55,0.1,0.05,0.13
        for k in range(len(col_width)):
            cells[(i,k)].set_width(col_width[k])
        
    for pos, cell in cells.iteritems():
        cell.set_text_props( fontproperties=prop )

    the_table.auto_set_font_size(False)
    the_table.set_fontsize(11.5)
    plt.savefig(filename)
开发者ID:tallestorange,项目名称:DMM.Yell-API-Analysis,代码行数:30,代码来源:table.py


示例11: plot_aggregate_results

def plot_aggregate_results(wf_name, data):

    aggr = lambda results: int(interval_statistics(results if len(results) > 0 else [0.0])[0])
    # aggr = lambda results: len(results)

    data = data[wf_name]

    bins = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
    value_map = {b: [] for b in bins}

    for d in data:
        fcount = d["result"]["overall_failed_tasks_count"]
        makespan = d["result"]["makespan"]
        value_map[fcount].append(makespan)

    values = [bin for bin, values in sorted(value_map.items(), key=lambda x: x[0]) for _ in values]



    plt.grid(True)

    n, bins, patches = pylab.hist(values, bins, histtype='stepfilled')
    pylab.setp(patches, 'facecolor', 'g', 'alpha', 0.75)


    values = [aggr(values) for bin, values in sorted(value_map.items(), key=lambda x: x[0])]
    rows = [[str(v) for v in values]]

    the_table = plt.table(cellText=rows,
                      rowLabels=None,
                      colLabels=bins,
                      loc='bottom')

    pass
开发者ID:fonhorst,项目名称:heft,代码行数:34,代码来源:stat_aggregator.py


示例12: __init__

    def __init__(self):

        self.fig = plt.figure(figsize=(5, 5))
        ax = self.fig.add_subplot(1, 1, 1)
        ax.set_aspect("equal")
        ax.set_axis_off()
        self.fig.subplots_adjust(0.0, 0.0, 1, 1)
        
        data = np.repeat(np.arange(1, 10)[:, None], 9, axis=1)
        
        table = plt.table(cellText=data, loc="center", cellLoc="center")
        table.auto_set_font_size(False)
        table.set_fontsize(20)
        
        for v in np.arange(0.05, 1, 0.3):
            line1 = plt.Line2D([v, v], [0.05, 0.95], lw=2, color="k")
            line2 = plt.Line2D([0.05, 0.95], [v, v], lw=2, color="k")
            for line in (line1, line2):
                line.set_transform(ax.transAxes)
                ax.add_artist(line)
                
        self.cells = table._cells
            
        for loc, cell in self.cells.iteritems():
            cell.set_width(0.1)
            cell.set_height(0.1)
            cell.set_edgecolor("#AAAAAA")
            
        self.current_pos = (0, 0)
        self.set_current_cell((0, 0))
        self.setted_cells = {}
        self.solver = SudokuSolver()
        self.calc_solution()
        self.fig.canvas.mpl_connect("key_press_event", self.on_key)
开发者ID:hejibo,项目名称:scpy2,代码行数:34,代码来源:sudoku_solver_table.py


示例13: __init__

 def __init__(self, _title, _ylabel, row_labels, col_labels, table_data, save_fn=None):
     assert len(table_data) == len(row_labels)
     assert len(table_data[0]) == len(col_labels)
     fig = plt.figure(figsize=(6, 6))
     ax = fig.add_subplot(111)
     #
     bar_width = 0.5
     ind = [bar_width / 2 + i for i in xrange(len(col_labels))]
     #
     bar_data = table_data[:]
     bar_data.reverse()
     y_offset = np.array([0.0] * len(col_labels))
     for i, row_data in enumerate(bar_data):
         plt.bar(ind, row_data, bar_width, bottom=y_offset, color=clists[i])
         y_offset = y_offset + row_data
     ax.set_xlim(0, len(ind))
     #
     formated_table_data = []
     for r in table_data:
         formated_table_data.append(['{:,}'.format(x) for x in r])
     table = plt.table(cellText=formated_table_data, colLabels=col_labels, rowLabels=row_labels, loc='bottom')
     table.scale(1, 2)
     #
     plt.subplots_adjust(left=0.2, bottom=0.2)
     plt.ylabel(_ylabel)
     ax.yaxis.set_major_formatter(tkr.FuncFormatter(comma_formating))  # set formatter to needed axis
     plt.xticks([])
     plt.title(_title)
     if save_fn:
         plt.savefig('%s/%s.pdf' % (save_dir, save_fn))
     plt.show()
开发者ID:jerryhan88,项目名称:workspace_SMU,代码行数:31,代码来源:charts.py


示例14: _create_summary_table

def _create_summary_table(series_map, bins=None, **kwargs):

    rows = []
    row_labels = []
    column_labels = ['Total', 'Not Null', '% Shown']
    for group, srs in series_map.iteritems():

        total_num = len(srs)
        not_null = len(srs[pd.notnull(srs)])

        if bins is not None:
            not_shown = len(srs[(pd.isnull(srs)) | (srs > max(bins)) | (srs < min(bins))])
        else:
            not_shown = len(srs[(pd.isnull(srs))])

        percent_shown = (total_num - not_shown) / total_num * 100.0 if total_num > 0 else 0

        pct_string = "{number:.{digits}f}%".format(number=percent_shown, digits=1)

        row_labels.append(group)
        rows.append([total_num, not_null, pct_string])

    table = plt.table(cellText=rows,
                      rowLabels=row_labels,
                      colLabels=column_labels,
                      colWidths=[0.08] * 3,
                      loc='upper center')

    _make_table_pretty(table, **kwargs)

    return table
开发者ID:ghl3,项目名称:bamboo,代码行数:31,代码来源:addons.py


示例15: to_PNG

    def to_PNG(self, OutputName='TLD.png', title='Trip-Length Distribution',
                   ylabel='Trips', units='',
                   legend=False, table=False, table_font_colors=True,
                   prefixes='', suffixes='',
                   *args, **kwargs):
        '''Produces a graph from TLD, all columns together.
        Includes average distance.
            prefixes         - to prepend to each column. Use as a marker.
            suffixes         - to append to each column. Use as a marker.
        '''

        if prefixes:
            try:
                self.columns = [prefix+col for col,prefix in zip(self.columns,prefixes)]
            except:
                raise ValueError("prefixes must have the same length as df.columns.")

        if suffixes:
            try:
                self.columns = [col+sufix for col,sufix in zip(self.columns,suffixes)]
            except:
                raise ValueError("suffixes must have the same length as df.columns.")

        if duplicates_in_list(self.columns):
            raise ValueError("Duplicate names in DataFrame's columns.")

        plt.clf()
        axs_subplot = self.plot(title=title, legend=legend)
        line_colors = [line.get_color() for line in axs_subplot.lines]

        if legend:
            lgd = plt.legend(loc='upper center', bbox_to_anchor=(0.5, -0.1),
                              fancybox=True, ncol=len(TLD.columns))
        plt.xlabel('Dist')
        plt.ylabel(ylabel)

        if units:
            col_label = 'Avg Dist ({})'.format(units)
        else:
            col_label = 'Avg Dist'

        if table:
            table = plt.table(
                cellText=[['{:,.2f}'.format(dist)] for dist in list(self.avgdist)],
                colWidths = [0.1],
                rowLabels=[' {} '.format(col) for col in self],
                colLabels=[col_label],
                loc='upper right')
            #table.set_fontsize(16)
            table.scale(2, 2)

        if table and table_font_colors:
            for i in range(len(line_colors)):
                #table.get_celld()[(i+1, -1)].set_edgecolor(line_colors[i])
                table.get_celld()[(i+1, -1)].set_text_props(color=line_colors[i])

        oName = OutputName
        plt.savefig(oName, bbox_inches='tight')
        plt.close()
开发者ID:jabellcu,项目名称:TPlanning_matrices,代码行数:59,代码来源:TLD.py


示例16: plot_results

def plot_results(x_axis, y_axis, x_min, x_max, labels):
    try:
        y_axis[0][0]
    except IndexError:
        # Convert 1D list to 2D
        y_axis = [y_axis]

    colors = ('blue', 'green', 'red', 'cyan', 'magenta', 'yellow', 'black')

    # Calculate means
    y_axis_means = []
    for dataset in y_axis:
        dataset_mean=[]
        for group_no in range(x_max - x_min + 1):
            group = dataset[group_no::x_max - x_min + 1]
            mean = sum(group) / len(group)
            dataset_mean.append(mean)
        y_axis_means.append(dataset_mean)

    fig, ax = plt.subplots()

    # Plot datapoints
    for color, label, dataset in zip(colors, labels, y_axis):
        ax.plot(x_axis, dataset, color=color, marker='.', linestyle=' ', alpha=0.3, label='{} datapoints'.format(label))

    # Plot mean
    for color, label, dataset_mean in zip(colors, labels, y_axis_means):
        ax.plot(x_axis[:x_max - x_min + 1], dataset_mean, color=color, linestyle='-', label='{} mean'.format(label))

    plt.ylabel("Recognition rate")
    plt.xlabel("Number of training")
    ax.legend(loc='lower right')
    ax.axis([x_min - 1, x_max + 1, 0, 1])
    plt.grid(True)

    # Add a table at the bottom of the axes
    plt.table(
        cellText=numpy.around(y_axis_means, decimals=2),
        rowLabels=labels,
        colLabels=range(x_min, x_max+1),
        loc='bottom',
        bbox=[0.20, -0.6, 0.75, 0.3]
    )
    plt.subplots_adjust(bottom=0.4)

    plt.show()
开发者ID:zidik,项目名称:PatternRecognition_HW_PCA_Combining,代码行数:46,代码来源:plotting.py


示例17: plot_metric_single_value

def plot_metric_single_value(stats_desc, outdir, num_phases):
    """Plot chart and save it as PNG file"""
    matrix = None
    if stats_desc == "average":
        matrix = AVG_TABLE
    elif stats_desc == "90th":
        matrix = Nth_TABLE
    elif stats_desc == "absolute_time":
        matrix = TIME_TABLE

    if len(matrix) > 0:
        fig = figure()
        ax = fig.add_subplot(1, 1, 1)
        ax.xaxis.set_visible(False)
        ax.yaxis.set_visible(False)
        ax.set_title('{0}_Value'.format(stats_desc))

        table_vals = []
        col_labels = []
        row_labels = []
        for k in matrix.iterkeys():
            temp_list = []
            for i in range(num_phases):
                if  i in matrix[k].keys():
                    temp_list.append(matrix[k][i])
                else:
                    temp_list.append(None)

            table_vals.append(temp_list)
            col_labels.append(k)

        invert_table = []
        for i in range(len(table_vals[0])):
            temp_list = []
            for j in range(len(table_vals)):
                temp_list.append(table_vals[j][i])
            invert_table.append(temp_list)

        for i in range(num_phases):
            row_labels.append("P %d" % (i))

        table(cellText=invert_table, colWidths = [0.2]*len(col_labels), rowLabels=row_labels,
              colLabels=col_labels, loc='center')

        fig.savefig('{0}/zz-{1}_value.png'.format(outdir, stats_desc), dpi=300)
开发者ID:ketakigangal,项目名称:cbmonitor,代码行数:45,代码来源:plotter.py


示例18: test3

def test3():
    cell_text = []
    for i in range(10):
        cell_text.append(np.linspace(0,i,10))

    the_table = plt.table(cellText=cell_text,
                          rowLabels=["%s row" % i for i in range(10)],
                          colLabels=["%s col" % i for i in range(10)])
    plt.show()
开发者ID:sophistcxf,项目名称:ThirdLibTest,代码行数:9,代码来源:test_table.py


示例19: summary

def summary(data):
    data_win = data[data.exit_profit>0]
    data_lose = data[data.exit_profit<0]
    zero_df = data[data.exit_profit==0]
    total_num = len(data)
    av_period = data['period'].mean()
    plt.figure()
    rows = [
            "Overall Profits: ", 
            "Overall Loss: ", 
            "Net Profits: ", 
            "Number of Transaction: ", 
            "Number of Winning Trades: ",
            "Number of Losing Trades: ",
            "Average Profit:",
            "AV Profits / AV Loss: ", 
            "Winning Percentage: ",
            "Stock Holding Period: " 
           ]

    cell_text=[
                [str(data_win.exit_profit.sum() * 300)],
                [str(data_lose.exit_profit.sum() * 300)],
                [str((data.exit_profit.sum()) * 300)],
                [str(total_num)],
                [str(len(data_win))],
                [str(len(data_lose))], 
                [str(data_win.exit_profit.sum()/ total_num*300)],
                [str(abs(data_win.exit_profit.sum()/len(data_win) / (data_lose.exit_profit.sum()/len(data_lose))))],
                [str(len(data_win)/float(total_num)*100) + "%" ], 
                [str(av_period)]
              ]
    columns=(['Summary'])
    assert len(cell_text) == len(rows)
    # Add a table at the bottom of the axes

    the_table = plt.table(cellText=cell_text,
                      colWidths = [0.4],
                      rowLabels=rows,
                      colLabels=columns,
                      loc='center right', fontsize=14)
    plt.text(12,3.4,'Table Title',size=8)
    six.print_("******************************************")
    six.print_("总盈利: " + str(data_win.exit_profit.sum() * 300))
    six.print_("总亏损: " + str(data_lose.exit_profit.sum() * 300))
    six.print_("总利润: " + str((data.exit_profit.sum()) * 300))
    six.print_("******************************************")
    six.print_("交易次数: " + str(total_num))
    six.print_("盈利次数: " + str(len(data_win)))
    six.print_("亏损次数: " + str(len(data_lose)))
    six.print_("平均利润: " + str(data_win.exit_profit.sum()/ total_num*300))
    six.print_("盈亏比: " + str(abs(data_win.exit_profit.sum()/len(data_win) / (data_lose.exit_profit.sum()/len(data_lose)))))
    six.print_("胜率: " + str(len(data_win)/float(total_num)*100) + "%" )
    six.print_("平均持仓周期: " + str(av_period))
    six.print_("******************************************")
开发者ID:QuantFans,项目名称:quantdigger,代码行数:55,代码来源:analyze.py


示例20: plot_matrix

def plot_matrix(matrix, columns = None, rows = None, title = None):
	# Add a table at the bottom of the axes
	print(title)
	fig = plt.figure()
	ax = fig.add_subplot(111)
	ax.xaxis.set_visible(False)
	ax.yaxis.set_visible(False)
	plt.axis('off')
	the_table = plt.table(cellText = matrix, colLabels = columns, rowLabels = rows, loc = "center")

	plt.show()
开发者ID:garibaldu,项目名称:multicauseRBM,代码行数:11,代码来源:plotter.py



注:本文中的matplotlib.pyplot.table函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyplot.text函数代码示例发布时间:2022-05-27
下一篇:
Python pyplot.switch_backend函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap