Matplotlib: Make all values in range show up on x axis

后端 未结 2 1650
感情败类
感情败类 2020-12-15 06:57

Could someone please guide me on how should I make sure that all ticks (or maybe a better way to specify will be to say all elements in the list passed to plot function) are

相关标签:
2条回答
  • 2020-12-15 07:41

    use this.

    fig = plt.figure(figsize=(10,8))
    plt.xticks(np.arange(min(x), max(x)+1, 1.0))
    
    0 讨论(0)
  • 2020-12-15 07:46

    Simply add plt.xticks(xValues) to your code. Given the number of points in your graph, the labels might clutter.

    You could display them as minor ticks if you set them on the axes object with ax.set_xticks(xValues, minor=True).

    0 讨论(0)
提交回复
热议问题