[英]Looking for ways to create a line graph, with words along y-axis and numbers accordingly, on the x-axis
Sorry if this seems simple, but I am only a student beginning coding and need this to complete a school project.对不起,如果这看起来很简单,但我只是一个开始编码的学生,需要它来完成学校项目。 I have my graph ready but am unable to find a way to attach my number statistics to their belonging titles.我已准备好图表,但无法找到将我的数字统计数据附加到他们所属标题的方法。 Any suggestions welcome.欢迎任何建议。
import matplotlib.pyplot as plt
xvalues = [1, 2, 3, 4, 5, 6]
yvalues = [1, 2, 4, 8, 16, 32]
plt.plot(xvalues, yvalues)
plt.ylabel('y axis')
plt.xlabel('x axis')
plt.show()
Im not very experienced, however I am willing to help you.我不是很有经验,但我愿意帮助你。 The easiest way to do this is by using the python module matplotlib.最简单的方法是使用 python 模块 matplotlib。 Using this module you can create a simple graph with the script above.使用此模块,您可以使用上面的脚本创建一个简单的图形。 The values in the lists xvalues[] and yvalues[] can be replaced by words without any problem, however they should be between " " to show it are strings.列表中的值 xvalues[] 和 yvalues[] 可以毫无问题地替换为单词,但是它们应该在 " " 之间以显示它是字符串。 For more information about matplotlib you could always go to matplotlib.org.有关 matplotlib 的更多信息,您可以随时访问 matplotlib.org。 I hope this is helpfull.我希望这会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.