Skip to content
Advertisement

I’m getting float axis even with the command MaxNlocator(integer=True)

I have this df called normales:

JavaScript

With this code i’m plotting time series and bars:

JavaScript

You can realize that i’m using ax.yaxis.set_major_locator(MaxNLocator(integer=True)) in every axis to make integer the numbers of the axis. Although i’m using ax.yaxis.set_major_locator(MaxNLocator(integer=True)) i’m getting graphics with non integer (float) values in the yaxis. Do you know why this is happening? enter image description here Thanks in advance.

Advertisement

Answer

From the MaxNLocator docs:

integer bool, default: False

If True, ticks will take only integer values, provided at least min_n_ticks integers are found within the view limits.

….

min_n_ticks int, default: 2

You need to change min_n_ticks to 1 since ax2 only has one integer within the view limits, namely 12.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement