I want to create likert-scale Python. I have xlsx or csv file to generate likert-scale Python (Column is questions, Row is answers). How to link the file with the code below.
rng = np.random.default_rng(seed=42)
data = pd.DataFrame(rng.choice(plot_likert.scales.agree, (200, 2)), columns=['Q1', 'Q2'])
ax = plot_likert.plot_likert(data, plot_likert.scales.agree, plot_percentage=True, figsize=(14, 4))
for bars, color in zip(ax.containers[1:], ['white'] + ['black'] * 2 + ['white'] * 2):
ax.bar_label(bars, label_type='center', fmt='%.1f %%', color=color, fontsize=15)
I'm newbie in python. I wanna create likert-scale Python with percent in graph.
Short answer: You are missing a
matplotlib.pyplot.show()For some reason, the quick start documentation for the plot_likert library doesn't mention it, but it doesn't display the graphs unless you include a
showcall, which I learned in the User Guide and is only mentioned in the "More advanced plots" section. Strangely enough, the library itself doesn't appear to have a utility to show the plot, you must additionally import matplotlib. I don't blame you for being confusedHere is a minimally altered version of your code that runs and shows the plot.
Let me know if you have any questions.