[Python] tick frequency when using seaborn/matplotlib boxplot

Discussão em 'Python' iniciado por Stack, Fevereiro 7, 2025.

  1. Stack

    Stack Membro Participativo

    I am plotting with seaborn a series of boxplots with

    sns.boxplot(full_array)


    where full_array contains 200 arrays. Therefore, I have 200 boxplots and ticks on the x-axis from 0 to 200.

    The xticks are too close to each other and I would like to show only some of them, for instance, a labeled xtick every 20, or so.

    I tried several solutions as those mentioned here but they did not work.

    Every time I sample the xticks, I get wrong labels for the ticks, as they get numbered from 0 to N, with unit spacing.

    For instance, with the line

    ax.xaxis.set_major_locator(ticker.MultipleLocator(20))


    I get a labelled xtick every 20 but the labels are 1, 2, 3, 4 instead of 20, 40, 60, 80...

    Continue reading...

Compartilhe esta Página