hibou.utils.get_ticks#
- hibou.utils.get_ticks(data_labels: array, nb_ticks: int, data_index: array = None)#
Returns the indexes and the labels based on the given number of ticks.
Parameters#
- data_labels
np.array The array that contains the labels.
- nb_ticks
int The number of ticks you want to display.
- data_index
np.array, optionnal By default:
None. The indexes of the labels.
Returns#
tupleThe tuple that contains the indexes and the labels.
Examples#
In a case where we need 10 ticks on an axes:
from hibou.utils import get_ticks ticks_indexes, ticks_labels = get_ticks(x_data_labels, 10)
You can also directly pass the result of
get_ticksinto the pyplot function:plt.xticks(*get_ticks(x_data_labels, 10))
- data_labels