0

Is there a way to get the default colormap in matplotlib?

I like it, and I have a number of plot pairs that I want to plot in "parallel" colors, e.g. draw one curve with a solid line and another in the same color that is dotted.

import matplotlib.pyplot as plt

fig = plt.figure(...)
ax = plt.add_subplot(1,1,1)
# obtain data from somewhere
t = ...
data_primary = ...    # list of y-axis data arrays
data_secondary = ...  # list of y-axis data arrays
# 
colormap = ?????????  # get colormap from somewhere
k = 0
for y_a, y_b in zip(data_primary, data_secondary):
    ax.plot(t,y_a,color = colormap[k], linestyle = '-')
    ax.plot(t,y_b,color = colormap[k], linestyle = ':')
    k += 1
Jason S
  • 184,598
  • 164
  • 608
  • 970

0 Answers0