2

I noticed some unexpected behaviour of the colormap functions of matplotlib. Consider the following example:

from matplotlib.cm import hot
c = hot(range(0, 512))

All colors c[255] to c[511] are the same, i.e. white. I would have expected the colormap function to normalize the input and scale accordingly. Of course values in between the first 256 colors don't make any sense given the color depth of a normal display, but just capping after the maximum number is reached seems unreasonable.

My goal is to plot two time series (some thousand values) against each other and assign a color according to the timestamp. What I currently see is the first 255 data points in different colors and the rest in white... Any hints on how to accomplish this efficiently?

Thanks in advance!

pktl2k
  • 598
  • 5
  • 12

1 Answers1

2

you could create your own colormap by using:

from matplotlib import cm
new_map = cm.gray.from_list('whatever', ('white', 'black'), N=512)

This would create a grayscale colormap ranging from 0 to 512.

F. Win
  • 390
  • 5
  • 17
  • Thanks, but I think I found a better solution here: http://stackoverflow.com/questions/35315259/using-colormap-with-bokeh-scatter – pktl2k Jun 21 '16 at 15:31