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


Python collections.EventCollection方法代码示例

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


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

示例1: test__EventCollection__add_positions

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import EventCollection [as 别名]
def test__EventCollection__add_positions():
    '''
    check to make sure add_positions works properly
    '''
    splt, coll, props = generate_EventCollection_plot()
    new_positions = np.hstack([props['positions'],
                               props['extra_positions'][0]])
    coll.add_positions(props['extra_positions'][0])
    np.testing.assert_array_equal(new_positions, coll.get_positions())
    check_segments(coll,
                   new_positions,
                   props['linelength'],
                   props['lineoffset'],
                   props['orientation'])
    splt.set_title('EventCollection: add_positions')
    splt.set_xlim(-1, 35) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:18,代码来源:test_collections.py

示例2: test__EventCollection__append_positions

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import EventCollection [as 别名]
def test__EventCollection__append_positions():
    '''
    check to make sure append_positions works properly
    '''
    splt, coll, props = generate_EventCollection_plot()
    new_positions = np.hstack([props['positions'],
                               props['extra_positions'][2]])
    coll.append_positions(props['extra_positions'][2])
    np.testing.assert_array_equal(new_positions, coll.get_positions())
    check_segments(coll,
                   new_positions,
                   props['linelength'],
                   props['lineoffset'],
                   props['orientation'])
    splt.set_title('EventCollection: append_positions')
    splt.set_xlim(-1, 90) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:18,代码来源:test_collections.py

示例3: test__EventCollection__extend_positions

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import EventCollection [as 别名]
def test__EventCollection__extend_positions():
    '''
    check to make sure extend_positions works properly
    '''
    splt, coll, props = generate_EventCollection_plot()
    new_positions = np.hstack([props['positions'],
                               props['extra_positions'][1:]])
    coll.extend_positions(props['extra_positions'][1:])
    np.testing.assert_array_equal(new_positions, coll.get_positions())
    check_segments(coll,
                   new_positions,
                   props['linelength'],
                   props['lineoffset'],
                   props['orientation'])
    splt.set_title('EventCollection: extend_positions')
    splt.set_xlim(-1, 90) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:18,代码来源:test_collections.py

示例4: test__EventCollection__switch_orientation_2x

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import EventCollection [as 别名]
def test__EventCollection__switch_orientation_2x():
    '''
    check to make sure calling switch_orientation twice sets the
    orientation back to the default
    '''
    splt, coll, props = generate_EventCollection_plot()
    coll.switch_orientation()
    coll.switch_orientation()
    new_positions = coll.get_positions()
    assert_equal(props['orientation'], coll.get_orientation())
    assert_equal(True, coll.is_horizontal())
    np.testing.assert_array_equal(props['positions'], new_positions)
    check_segments(coll,
                   new_positions,
                   props['linelength'],
                   props['lineoffset'],
                   props['orientation'])
    splt.set_title('EventCollection: switch_orientation 2x') 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:20,代码来源:test_collections.py

示例5: test__EventCollection__set_orientation

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import EventCollection [as 别名]
def test__EventCollection__set_orientation():
    '''
    check to make sure set_orientation works properly
    '''
    splt, coll, props = generate_EventCollection_plot()
    new_orientation = 'vertical'
    coll.set_orientation(new_orientation)
    assert_equal(new_orientation, coll.get_orientation())
    assert_equal(False, coll.is_horizontal())
    check_segments(coll,
                   props['positions'],
                   props['linelength'],
                   props['lineoffset'],
                   new_orientation)
    splt.set_title('EventCollection: set_orientation')
    splt.set_ylim(-1, 22)
    splt.set_xlim(0, 2) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:19,代码来源:test_collections.py

示例6: test__EventCollection__switch_orientation_2x

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import EventCollection [as 别名]
def test__EventCollection__switch_orientation_2x():
    '''
    check to make sure calling switch_orientation twice sets the
    orientation back to the default
    '''
    splt, coll, props = generate_EventCollection_plot()
    coll.switch_orientation()
    coll.switch_orientation()
    new_positions = coll.get_positions()
    assert props['orientation'] == coll.get_orientation()
    assert coll.is_horizontal()
    np.testing.assert_array_equal(props['positions'], new_positions)
    check_segments(coll,
                   new_positions,
                   props['linelength'],
                   props['lineoffset'],
                   props['orientation'])
    splt.set_title('EventCollection: switch_orientation 2x') 
开发者ID:holzschu,项目名称:python3_ios,代码行数:20,代码来源:test_collections.py

示例7: test__EventCollection__set_orientation

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import EventCollection [as 别名]
def test__EventCollection__set_orientation():
    '''
    check to make sure set_orientation works properly
    '''
    splt, coll, props = generate_EventCollection_plot()
    new_orientation = 'vertical'
    coll.set_orientation(new_orientation)
    assert new_orientation == coll.get_orientation()
    assert not coll.is_horizontal()
    check_segments(coll,
                   props['positions'],
                   props['linelength'],
                   props['lineoffset'],
                   new_orientation)
    splt.set_title('EventCollection: set_orientation')
    splt.set_ylim(-1, 22)
    splt.set_xlim(0, 2) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:19,代码来源:test_collections.py

示例8: generate_EventCollection_plot

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import EventCollection [as 别名]
def generate_EventCollection_plot():
    '''
    generate the initial collection and plot it
    '''
    positions = np.array([0., 1., 2., 3., 5., 8., 13., 21.])
    extra_positions = np.array([34., 55., 89.])
    orientation = 'horizontal'
    lineoffset = 1
    linelength = .5
    linewidth = 2
    color = [1, 0, 0, 1]
    linestyle = 'solid'
    antialiased = True

    coll = EventCollection(positions,
                           orientation=orientation,
                           lineoffset=lineoffset,
                           linelength=linelength,
                           linewidth=linewidth,
                           color=color,
                           linestyle=linestyle,
                           antialiased=antialiased
                           )

    fig = plt.figure()
    splt = fig.add_subplot(1, 1, 1)
    splt.add_collection(coll)
    splt.set_title('EventCollection: default')
    props = {'positions': positions,
             'extra_positions': extra_positions,
             'orientation': orientation,
             'lineoffset': lineoffset,
             'linelength': linelength,
             'linewidth': linewidth,
             'color': color,
             'linestyle': linestyle,
             'antialiased': antialiased
             }
    splt.set_xlim(-1, 22)
    splt.set_ylim(0, 2)
    return splt, coll, props 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:43,代码来源:test_collections.py

示例9: test__EventCollection__set_positions

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import EventCollection [as 别名]
def test__EventCollection__set_positions():
    '''
    check to make sure set_positions works properly
    '''
    splt, coll, props = generate_EventCollection_plot()
    new_positions = np.hstack([props['positions'], props['extra_positions']])
    coll.set_positions(new_positions)
    np.testing.assert_array_equal(new_positions, coll.get_positions())
    check_segments(coll, new_positions,
                   props['linelength'],
                   props['lineoffset'],
                   props['orientation'])
    splt.set_title('EventCollection: set_positions')
    splt.set_xlim(-1, 90) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:16,代码来源:test_collections.py

示例10: test__EventCollection__set_linelength

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import EventCollection [as 别名]
def test__EventCollection__set_linelength():
    '''
    check to make sure set_linelength works properly
    '''
    splt, coll, props = generate_EventCollection_plot()
    new_linelength = 15
    coll.set_linelength(new_linelength)
    assert_equal(new_linelength, coll.get_linelength())
    check_segments(coll,
                   props['positions'],
                   new_linelength,
                   props['lineoffset'],
                   props['orientation'])
    splt.set_title('EventCollection: set_linelength')
    splt.set_ylim(-20, 20) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:17,代码来源:test_collections.py

示例11: test__EventCollection__set_lineoffset

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import EventCollection [as 别名]
def test__EventCollection__set_lineoffset():
    '''
    check to make sure set_lineoffset works properly
    '''
    splt, coll, props = generate_EventCollection_plot()
    new_lineoffset = -5.
    coll.set_lineoffset(new_lineoffset)
    assert_equal(new_lineoffset, coll.get_lineoffset())
    check_segments(coll,
                   props['positions'],
                   props['linelength'],
                   new_lineoffset,
                   props['orientation'])
    splt.set_title('EventCollection: set_lineoffset')
    splt.set_ylim(-6, -4) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:17,代码来源:test_collections.py

示例12: test__EventCollection__set_linestyle

# 需要导入模块: from matplotlib import collections [as 别名]
# 或者: from matplotlib.collections import EventCollection [as 别名]
def test__EventCollection__set_linestyle():
    '''
    check to make sure set_linestyle works properly
    '''
    splt, coll, _ = generate_EventCollection_plot()
    new_linestyle = 'dashed'
    coll.set_linestyle(new_linestyle)
    assert_equal(coll.get_linestyle(), [(0, (6.0, 6.0))])
    splt.set_title('EventCollection: set_linestyle') 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:11,代码来源:test_collections.py


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