简体   繁体   中英

Matplotlib Axes Labels not Displaying

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()

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM