Печать с marplotlib не показывает все элементы в списке - PullRequest
0 голосов
/ 21 сентября 2018

Эй, у меня немного странная проблема с matplotlib, у меня есть эта функция:

def line_plot(results):
    gen_eight = all_of_g(results, 8)
    gen_sixteen = all_of_g(results, 16)
    gen_thirty_two = all_of_g(results, 32)
    print(len(gen_eight))
    print(len(gen_sixteen))
    print(len(gen_thirty_two))

    N = 12


    fig, ax = plt.subplots()

    #ind = np.arange(N)    # the x locations for the groups
    #width = 0.15         # the width of the bars

    plt.plot(gen_eight)
    plt.plot(gen_sixteen)
    plt.plot(gen_thirty_two)

    ax.set_xticklabels(('1MB', '4MB', '8MB', '10MB', '16MB', '32MB', '64MB', '100MB', '128MB', '256MB', '512MB', '1GB'))
    plt.tight_layout()
    plt.show()

Но то, что она показывает, это то, что вы видели на изображении ниже, а три двенадцатилетних - это отпечаткидлина.Таким образом, отсутствует половина значений.

enter image description here

Что мне действительно странно, так это то, что эта функция

def bar_plot(results):

    gen_eight = all_of_g(results, 8)
    gen_sixteen = all_of_g(results, 16)
    gen_thirty_two = all_of_g(results, 32)

    print(gen_eight)


    N = 12


    fig, ax = plt.subplots()

    ind = np.arange(N)    # the x locations for the groups
    width = 0.30         # the width of the bars
    p1 = ax.bar(ind, gen_eight, width, color='r')
    p2 = ax.bar(ind+width, gen_sixteen, width, color='y')
    p3 = ax.bar(ind+width+width, gen_thirty_two, width, color='b')



    #ax.set_title('Scores by group and gender')
    ax.set_xticks(ind + width / 2)
    ax.set_xticklabels(('1MB', '4MB', '8MB', '10MB', '16MB', '32MB', '64MB', '100MB', '128MB', '256MB', '512MB', '1GB'))

    plt.xticks(rotation=75)

    ax.legend((p1[0], p2[0], p3[0]), ('g=8', 'g=16','g=32'))
    ax.autoscale_view()
    plt.ylabel('time (ms)')
    plt.xlabel('Data Size')
    plt.yscale("log", nonposy='clip')
    plt.tight_layout()
    fig.savefig('NOT_SHOWING')

    plt.show()

работает и строит графиккак и должно быть.Я надеюсь, что кто-то может помочь мне

enter image description here

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...