Created
March 12, 2018 19:25
-
-
Save ruivieira/8a0805c954d0427eb5254de9ffa0b085 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| from matplotlib import cm | |
| import matplotlib.pyplot as plt | |
| sample=np.array(['a1','a2','a3','a4','a5','a6']) | |
| y_pos = np.arange(len(sample)) | |
| probability=np.array([0.1, 0.05, 0.05, 0.2, 0.4, 0.2]) | |
| colours = cm.Blues(probability / max(probability)) | |
| p = plt.scatter(y_pos, probability, alpha=0.5, c=probability, cmap = 'Blues') | |
| plt.clf() | |
| plt.colorbar(p) | |
| plt.bar(range(len(probability)), [1]*len(sample), color = colours) | |
| plt.xticks(y_pos, sample) | |
| plt.ylabel('probability') | |
| plt.title('Category probabilities') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment