【发布时间】:2017-04-26 00:28:58
【问题描述】:
下面是我编写的一个函数,它根据分数元组列表(分数及其频率)创建图表
def initialise_chart(self, scores):
pg.setConfigOption("background", "w")
pg.setConfigOption("foreground", "k")
results_graph = pg.PlotWidget()
self.chart_results.addWidget(results_graph)
results_graph.plot([i[0] for i in scores], [i[1] for i in scores], pen={'color': "#006eb4"})
results_graph.setLabels(left="Frequency", bottom="Scores")
results_graph.setXRange(0, self.max_mark, padding=0)
有什么方法可以设置 y 轴的间隔,使数字以 1 为步长增加,但范围仍然是自动缩放的?例如。示例图的 y 轴上显示的唯一数字是 0、1、2
【问题讨论】: