[Python] plot-likert not printing labels for smaller values

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

  1. Stack

    Stack Membro Participativo

    I have the below code as per https://github.com/nmalkin/plot-likert/blob/release/docs/guide.ipynb

    !pip install plot_likert

    import plot_likert
    import pandas as pd
    import matplotlib.pyplot as plt

    precomputed_counts2 = pd.DataFrame(
    {'Strongly disagree': {'Q1': 3.0},
    'Disagree': {'Q1': 9.0},
    'Neither agree nor disagree': {'Q1': 13.0},
    'Agree': {'Q1': 69.0},
    'Strongly agree': {'Q1': 31.0}}
    )
    precomputed_counts2

    ax=plot_likert.plot_counts(precomputed_counts2, plot_likert.scales.agree,colors=plot_likert.colors.likert6,bar_labels_color="black",bar_labels="count");
    ax.figure.set_size_inches(12, 2)
    ax.xaxis.set_label_text('Difficulty Level of Questions');


    And the Output is as below: The output has labels but not for Strongly Disagree

    How to ensure all options have the data labels in the plot?

    I tried to increase the value of Strongly Disagree from 3 to 15 and it does show up as data label in the output.

    Continue reading...

Compartilhe esta Página