當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。