Created
January 7, 2019 11:44
-
-
Save cojocar/07d613dde8d18c7fa12397a5db69d29e to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
import matplotlib.pyplot as plt | |
import matplotlib.patches as patches | |
COLORS = plt.style.library['bmh']['axes.color_cycle'] | |
def show_colors(): | |
fig, ax = plt.subplots(1) | |
L = 10 | |
H = 40 | |
for idx in range(len(COLORS)): | |
print(idx) | |
c = COLORS[idx] | |
rect = patches.Rectangle((idx*L, 0), L, H, edgecolor=c,facecolor=c) | |
# Add the patch to the Axes | |
ax.add_patch(rect) | |
ax.text(idx*L+L/2, 0, str(idx)) | |
plt.xticks([0, L*len(COLORS)]) | |
plt.show() | |
show_colors() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment