本文整理汇总了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
示例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()
示例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 )