当前位置: 首页>>代码示例>>Python>>正文


Python Axes.set_xticks方法代码示例

本文整理汇总了Python中matplotlib.axes.Axes.set_xticks方法的典型用法代码示例。如果您正苦于以下问题:Python Axes.set_xticks方法的具体用法?Python Axes.set_xticks怎么用?Python Axes.set_xticks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.axes.Axes的用法示例。


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

示例1: drawG

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_xticks [as 别名]
def drawG(fig, n, roundN, graphs):
    graphsId = difGraphsId(graphs)
    size = len(graphsId)
    print 'size ', size
    bgnX = 0.1
    bgnY = 0.1
    width = 0.8 / size
    height = 0.35

    for idx in range(size):
        ax = Axes(fig, [bgnX, bgnY, width * 0.9, height])
        ax.set_xticks(range(-1,3))
        ax.set_yticks(range(-1, n+1))
        ax.set_frame_on(False)

        gid = graphsId[idx]
        ax.set_title( 'Round ' + str(gid+1) )

        for i in range(-1, n + 1):
            ax.plot(0, i, marker = 'o')
            ax.plot(1, i, marker = 'o')

        for edge in graphs[gid]:
            nodes = [int(i) for i in edge.split('-')]
            nodes[1] -= n
            line = Line2D([0, 1], nodes)

            if gid == 0:
                line.set_color('b')
            else:
                color = 'r'
                for e in graphs[gid-1]:
                    if edge == e:
                        color = 'b'
                        break
                line.set_color(color)

            ax.add_line( line )

        preId = max(gid-1, 0)
        for edge in graphs[preId]:
            color = 'g'
            for e in graphs[gid]:
                if edge == e:
                    color = 'b'
                    break

            if color == 'g':
                nodes = [int(i) for i in edge.split('-')]
                nodes[1] -= n
                line = Line2D([0, 1], nodes, linestyle= '--')
                line.set_color(color)
                ax.add_line( line )

        fig.add_axes( ax )
        bgnX += width
开发者ID:iSuneast,项目名称:Market,代码行数:58,代码来源:makeLog.py

示例2: center_histogram_1d

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_xticks [as 别名]
def center_histogram_1d(par):
    '''
        Create histogram of fiber centroid in 1D and compare it with solved value
    '''
    fig33 = figure(3)
    ax33 = Axes(fig33, [.1, .1, .8, .8])
    fig33.add_axes(ax33)
    div = 100.
    ll = l_dict[par]
    ss = ss_dict[par]
    xx = linspace(0, ll / 2., 1000)
    #pdf, bins, patches = hist( sx[0], div, normed=0 )
    #plot( xx, pdf_x_func( l_x, lf, xx, l_x / div ) * n / 2., color='red', linewidth=4 )
    pdf, bins, patches = hist(ss[0], div, normed = 1)
    plot(xx, pdf_x_0_func(ll, fib.lf, xx, 0) , color = 'red', linewidth = 4)
    ax33.set_xticks(arange(-ll / 2., ll / 2., ll / 10.))
    title('histogram of fibers centroid in 1D -- sim')
    draw()
开发者ID:kelidas,项目名称:scratch,代码行数:20,代码来源:specimen3D_fibers.py

示例3: drawEP

# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import set_xticks [as 别名]
def drawEP(fig, n, roundN, endowments, prices):
    ax = Axes(fig, [.1, .55, .8, .35])
    ax.grid(True)
    ax.set_xticks( range(roundN+1) )
    ax.set_frame_on(False)

    users = [[] for i in range(n)]
    for i in range(n):
        for j in range(roundN):
            users[i].append( float(Fraction(endowments[j][i])) )
        users[i].append( float(Fraction(prices[roundN-1][i])) )

    x = range(roundN+1)
    for i in range(n):
        price = round(float(Fraction(prices[roundN-1][i])), 3)
        ax.plot(x, users[i], linestyle = '--', marker = 'o', label = str(i) + ": " + str(price))
#    ax.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=2, ncol=min(n, 5), mode="expand", borderaxespad=0.)
    ax.legend()

    fig.add_axes( ax )
开发者ID:iSuneast,项目名称:Market,代码行数:22,代码来源:makeLog.py


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