Last active
May 20, 2020 18:36
-
-
Save dkirkby/55980e339342e8b50d45c6153ef9fed5 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
# Reuse the automatically selected color from a plot | |
line2d = plt.plot([0, 1], [0, 1], ':') | |
plt.scatter([0, 1], [0, 1], c=line2d[0].get_color()) | |
# Reuse the automatically selected color from a scatter | |
pathcol = plt.scatter([0, 1], [0, 1]) | |
plt.plot([0, 1], [0, 1], c=pathcol.get_fc()[0], ls=':') | |
# Use the j-th default color | |
c = plt.rcParams['axes.prop_cycle'].by_key()['color'][j] | |
# Specify a default color explicitly via Ck | |
for k, y in enumerate(...): | |
plt.plot(x, y, '.', c=f'C{k}') | |
plt.plot([], [], '-', c=f'C{k}', label=str(k)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment