简体   繁体   English

Matplotlib 轴标签不显示

[英]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. xlabelylabel是函数-您不能直接设置值。 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 . 请参阅此处的参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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