Home > database >  How to change y-axis increments in Matplotlib
How to change y-axis increments in Matplotlib

Time:03-22

I currently have a graph in Matplotlib with the y-axis incrementing by .5 up to 2.0. How would I change it so it increments by .3? Such that it goes 0, .3, .6, .9, 1.2....?

CodePudding user response:

If you know exactly the increments you are looking for, you can use matplotlib.pyplot.yticks(...) or matplotlib.axes.Axes.set_yticks(...) depending on how you are interacting with matplotlib. Simply pass the list of ticks you want to use.

  • Related