Python matplotlib.pylab 模块,annotate() 实例源码

我们从Python开源项目中,提取了以下11个代码示例,用于说明如何使用matplotlib.pylab.annotate()

项目:DeepLearning    作者:STHSF    | 项目源码 | 文件源码
def plot(embeddings, labels):
    assert embeddings.shape[0] >= len(labels), 'More labels than embeddings'
    pylab.figure(figsize=(15, 15))  # in inches
    for i, label in enumerate(labels):
        x, y = embeddings[i, :]
        pylab.scatter(x, y)
        pylab.annotate(label, xy=(x, y), xytext=(5, 2), textcoords='offset points',
                       ha='right', va='bottom')
    pylab.show()
项目:udacity    作者:kensk8er    | 项目源码 | 文件源码
def plot(embeddings, labels):
    assert embeddings.shape[0] >= len(labels), 'More labels than embeddings'

    pylab.figure(figsize=(15, 15))  # in inches

    for i, label in enumerate(labels):
        x, y = embeddings[i, :]
        pylab.scatter(x, y)
        pylab.annotate(label, xy=(x, y), xytext=(5, 2), textcoords='offset points', ha='right', va='bottom')

    pylab.show()
项目:itunes    作者:kaminem64    | 项目源码 | 文件源码
def plot(embeddings, labels):
  assert embeddings.shape[0] >= len(labels), 'More labels than embeddings'
  pylab.figure(figsize=(15,15))  # in inches
  for i, label in enumerate(labels):
    x, y = embeddings[i,:]
    pylab.scatter(x, y)
    pylab.annotate(label, xy=(x, y), xytext=(5, 2), textcoords='offset points',
                   ha='right', va='bottom')
  pylab.show()
项目:udacity-deep-learning    作者:hankcs    | 项目源码 | 文件源码
def plot(embeddings, labels):
    assert embeddings.shape[0] >= len(labels), 'More labels than embeddings'
    pylab.figure(figsize=(15, 15))  # in inches
    for i, label in enumerate(labels):
        x, y = embeddings[i, :]
        pylab.scatter(x, y)
        pylab.annotate(label, xy=(x, y), xytext=(5, 2), textcoords='offset points',
                       ha='right', va='bottom')
    pylab.show()
项目:udacity-deep-learning    作者:hankcs    | 项目源码 | 文件源码
def plot(embeddings, labels):
    assert embeddings.shape[0] >= len(labels), 'More labels than embeddings'
    pylab.figure(figsize=(15, 15))  # in inches
    for i, label in enumerate(labels):
        x, y = embeddings[i, :]
        pylab.scatter(x, y)
        pylab.annotate(label, xy=(x, y), xytext=(5, 2), textcoords='offset points',
                       ha='right', va='bottom')
    pylab.show()
项目:udacity-deep-learning    作者:runhani    | 项目源码 | 文件源码
def plot(embeddings, labels):
  assert embeddings.shape[0] >= len(labels), 'More labels than embeddings'
  pylab.figure(figsize=(15,15))  # in inches
  for i, label in enumerate(labels):
    x, y = embeddings[i,:]
    pylab.scatter(x, y)
    pylab.annotate(label, xy=(x, y), xytext=(5, 2), textcoords='offset points',
                   ha='right', va='bottom')
  pylab.show()
项目:tensor_flow    作者:eecrazy    | 项目源码 | 文件源码
def plot(embeddings, labels):
  assert embeddings.shape[0] >= len(labels), 'More labels than embeddings'
  pylab.figure(figsize=(15,15))  # in inches
  for i, label in enumerate(labels):
    x, y = embeddings[i,:]
    pylab.scatter(x, y)
    pylab.annotate(label, xy=(x, y), xytext=(5, 2), textcoords='offset points',
                   ha='right', va='bottom')
  pylab.show()
项目:tensor_flow    作者:eecrazy    | 项目源码 | 文件源码
def plot(embeddings, labels):
  assert embeddings.shape[0] >= len(labels), 'More labels than embeddings'
  pylab.figure(figsize=(15,15))  # in inches
  for i, label in enumerate(labels):
    x, y = embeddings[i,:]
    pylab.scatter(x, y)
    pylab.annotate(label, xy=(x, y), xytext=(5, 2), textcoords='offset points',
                   ha='right', va='bottom')
  pylab.show()
项目:TensorFlowHub    作者:MJFND    | 项目源码 | 文件源码
def plot(embeddings, labels):
  assert embeddings.shape[0] >= len(labels), 'More labels than embeddings'
  pylab.figure(figsize=(15,15))  # in inches
  for i, label in enumerate(labels):
    x, y = embeddings[i,:]
    pylab.scatter(x, y)
    pylab.annotate(label, xy=(x, y), xytext=(5, 2), textcoords='offset points',
                   ha='right', va='bottom')
  pylab.show()
项目:TensorFlowHub    作者:MJFND    | 项目源码 | 文件源码
def plot(embeddings, labels):
  assert embeddings.shape[0] >= len(labels), 'More labels than embeddings'
  pylab.figure(figsize=(15,15))  # in inches
  for i, label in enumerate(labels):
    x, y = embeddings[i,:]
    pylab.scatter(x, y)
    pylab.annotate(label, xy=(x, y), xytext=(5, 2), textcoords='offset points',
                   ha='right', va='bottom')
  pylab.show()
项目:bnpy    作者:bnpy    | 项目源码 | 文件源码
def illustrate(Colors=Colors):
    if hasattr(Colors, 'colors'):
        Colors = Colors.colors

    from matplotlib import pylab
    rcParams = pylab.rcParams
    rcParams['pdf.fonttype'] = 42
    rcParams['ps.fonttype'] = 42
    rcParams['text.usetex'] = False
    rcParams['xtick.labelsize'] = 20
    rcParams['ytick.labelsize'] = 20
    rcParams['legend.fontsize'] = 25

    import bnpy

    Data = get_data(T=1000, nDocTotal=8)
    for k in xrange(K):
        zmask = Data.TrueParams['Z'] == k
        pylab.plot(Data.X[zmask, 0], Data.X[zmask, 1], '.', color=Colors[k],
                   markeredgecolor=Colors[k],
                   alpha=0.4)

        sigEdges = np.flatnonzero(transPi[k] > 0.0001)
        for j in sigEdges:
            if j == k:
                continue
            dx = mus[j, 0] - mus[k, 0]
            dy = mus[j, 1] - mus[k, 1]
            pylab.arrow(mus[k, 0], mus[k, 1],
                        0.8 * dx,
                        0.8 * dy,
                        head_width=2, head_length=4,
                        facecolor=Colors[k], edgecolor=Colors[k])

            tx = 0 - mus[k, 0]
            ty = 0 - mus[k, 1]
            xy = (mus[k, 0] - 0.2 * tx, mus[k, 1] - 0.2 * ty)
            '''
            pylab.annotate( u'\u27F2',
                      xy=(mus[k,0], mus[k,1]),
                     color=Colors[k],
                     fontsize=35,
                    )
            '''
            pylab.gca().yaxis.set_ticks_position('left')
            pylab.gca().xaxis.set_ticks_position('bottom')

            pylab.axis('image')
            pylab.ylim([-38, 38])
            pylab.xlim([-38, 38])