本文整理汇总了Python中numerix.ones函数的典型用法代码示例。如果您正苦于以下问题:Python ones函数的具体用法?Python ones怎么用?Python ones使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ones函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _get_handles
def _get_handles(self, handles, texts):
HEIGHT = self._approx_text_height()
ret = [] # the returned legend lines
for handle, label in zip(handles, texts):
x, y = label.get_position()
x -= self.handlelen + self.handletextsep
if isinstance(handle, Line2D):
ydata = (y-HEIGHT/2)*ones(self._xdata.shape, Float)
legline = Line2D(self._xdata, ydata)
legline.update_from(handle)
self._set_artist_props(legline) # after update
legline.set_clip_box(None)
legline.set_markersize(self.markerscale*legline.get_markersize())
ret.append(legline)
elif isinstance(handle, Patch):
p = Rectangle(xy=(min(self._xdata), y-3/4*HEIGHT),
width = self.handlelen, height=HEIGHT/2,
)
p.update_from(handle)
self._set_artist_props(p)
p.set_clip_box(None)
ret.append(p)
elif isinstance(handle, LineCollection):
ydata = (y-HEIGHT/2)*ones(self._xdata.shape, Float)
legline = Line2D(self._xdata, ydata)
self._set_artist_props(legline)
legline.set_clip_box(None)
lw = handle.get_linewidth()[0]
dashes = handle.get_dashes()
color = handle.get_colors()[0]
legline.set_color(color)
legline.set_linewidth(lw)
legline.set_dashes(dashes)
ret.append(legline)
elif isinstance(handle, RegularPolyCollection):
p = Rectangle(xy=(min(self._xdata), y-3/4*HEIGHT),
width = self.handlelen, height=HEIGHT/2,
)
p.set_facecolor(handle._facecolors[0])
if handle._edgecolors != 'None':
p.set_edgecolor(handle._edgecolors[0])
self._set_artist_props(p)
p.set_clip_box(None)
ret.append(p)
else:
ret.append(None)
return ret
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:55,代码来源:legend.py
示例2: styles_example
def styles_example(epsoutfile):
mystyles = ['.', '-', '-"', '_ ', '6_1 ', '- . ']
count = len(mystyles)
x1 = 0.8*arange(2)
g = pyxgraph(xlimits=(-0.1, 1.1), xticks=(0, 1, 1),
ylimits=(-1, count), yticks=(0, count-1, 1),
ylabel='linestyles', key=None, width=8)
for i in xrange(count):
y = ones(2)+i-1
g.pyxplot((x1, y), style="l", lw=1, color=0, lt=mystyles[i])
g.pyxlabel((0.85, i),
'\\tt{'+repr(mystyles[i]).replace('_','\\_')+'}',
style=[pyx.text.halign.left], graphcoords=True)
g.pyxsave(epsoutfile)
开发者ID:deprecated,项目名称:pyxgraph,代码行数:17,代码来源:styles_example3.py
示例3: styles_example
def styles_example(epsoutfile):
x1 = 0.25*arange(2)
x2 = x1+0.5-0.125
x3 = x1+1.0-0.25
g = pyxgraph(xlimits=(-0.1, 1.1), xticks=(0, 1, 1),
ylimits=(-1, 12), yticks=(0, 11, 1),
ylabel='linestyles', key=None, width=8)
for i in xrange(12):
y = ones(2)+i-1
g.pyxplot((x1, y), style="l", lw=1, color=0, lt=i)
g.pyxplot((x2, y), style="l", lw=3, color=0, lt=i)
g.pyxplot((x3, y), style="l", lw=1, color=0, lt=i, dl=4)
g.pyxlabel( (0.125,1.05), "lw=1", [pyx.text.halign.center])
g.pyxlabel( (0.5,1.05), "lw=3", [pyx.text.halign.center])
g.pyxlabel( (0.875,1.05), "lw=1, dl=4", [pyx.text.halign.center])
g.pyxsave(epsoutfile)
开发者ID:deprecated,项目名称:pyxgraph,代码行数:18,代码来源:styles_example.py
注:本文中的numerix.ones函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论