Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import numpy as np
- y_values = [0.1, 0.3, 0.4, 0.2]
- text_values = ["word 1", "word 2", "word 3", "word 4"]
- x_values = np.arange(1, len(text_values) + 1, 1)
- plt.bar(x_values, y_values, align='center')
- # Decide which ticks to replace.
- new_ticks = ["word for " + str(y) if y != 0 else str(y) for y in y_values]
- plt.yticks(y_values, new_ticks)
- plt.xticks(x_values, text_values)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement