I use the following script for plotting:
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pylab as pl
import math
import matplotlib as mpl
from matplotlib.ticker import MultipleLocator
from matplotlib.colors import LinearSegmentedColormap
cdict1 = {'red': ((0.0, 1.0, 1.0),
(0.4, 1.0, 1.0),
(0.7, 0.0, 0.0),
(1.0, 0.0, 0.0)),
'green': ((0.0, 1.0, 1.0),
(0.1, 0.0, 0.0),
(1.0, 0.0, 0.0)),
'blue': ((0.0, 1.0, 1.0),
(0.1, 0.0, 0.0),
(0.4, 0.0, 0.0),
(1.0, 1.0, 1.0))
}
white_blue_red = LinearSegmentedColormap('WhiteBlueRed', cdict1)
plt.register_cmap(cmap=white_blue_red)
x = np.loadtxt('data.dat',
unpack=True)
plt.scatter(x[0], x[1], marker='.', s=3, linewidths=0, c=x[3], cmap= \
plt.get_cmap('WhiteBlueRed')) # plt.cm.bwr
plt.colorbar()
plt.show()
The colormap I have defined uses relative values (0 minimum value of function 1 maximum value). the problem is that I want to use that code for plotting hundreds of different files and I want that each plot has the exact same colormap. Is there the possibility to define colormaps with absolute values? That would solve my problem.