Hello all!
I am making a barchart but I have two problems.
1.
I have 8 values, each of them is between 0-100. Now if I get a smaller value (eg.: 68) the "x" line only reaches 80. How can I fix it to always show it until 100?
2.
How can I write the exact values at the end of each bars?
code:
I am making a barchart but I have two problems.
1.
I have 8 values, each of them is between 0-100. Now if I get a smaller value (eg.: 68) the "x" line only reaches 80. How can I fix it to always show it until 100?
2.
How can I write the exact values at the end of each bars?
code:
import numpy as np import matplotlib.pyplot as plt Enthusiastic = 10 Practical = 15 Immaginative = 20 Logical = 25 Auditive = 30 Visual = 80 Kinestetic_emotional = 40 Kinestetic_touching = 90 fig, ax = plt.subplots() plt.title ("Personality test") plt.xlabel ("Your score based on your answers") plt.ylabel ("Types of thinking") thinking = ("Enthusiastic", "Practical", "Immaginative", "Logical", "Auditive", "Visual", "Kinestetic(emotional)", "Kinestetic(touching)") y_pos = np.arange(len(thinking)) scores = (Enthusiastic,Practical,Immaginative,Logical,Auditive,Visual,Kinestetic_emotional,Kinestetic_touching) ax.set_yticks(y_pos) ax.set_yticklabels(thinking,) ax.invert_yaxis() plt.barh(y_pos,scores,color = "g") plt.show()Thank you for you help!
