Matplotlib Axes Labels not Displaying

13,511

xlabel and ylabel are functions - you can't set the values directly. Your code should read as follows:

f= open("test1T.txt")
t1T = f.read()
x= [min_crib_dist("squeamish ossifrage",sub_cipher(t1T,rand_dict())) for i in range(10000)]
plt.xlabel('Minimum Hamming Distance')
plt.ylabel("Number of Simulations")
plt.hist(x, bins=10)
plt.show()

See reference here.

Share:
13,511
clovis
Author by

clovis

prone to asking stupid things but it's out of the goodness of my heart

Updated on June 04, 2022

Comments

  • clovis
    clovis almost 2 years

    What are some possible reasons that axes labels for a graph won't show up? The graph itself works fine but the labels don't.

    f= open("test1T.txt")
    t1T = f.read()
    x= [min_crib_dist("squeamish ossifrage",sub_cipher(t1T,rand_dict())) for i in range(10000)]
    plt.xlabel = ('Minimum Hamming Distance')
    plt.ylabel = "Number of Simulations"
    plt.hist(x, bins=10)
    plt.show()