I have a problem creating a contourf-plot in python and setting the limits of the colorbar.
I have set them in so far that the color scaling is correct, but only the part that is used is depicted.
My code looks like this:
import numpy as np
import matplotlib.pyplot as plt
data = np.loadtxt("./somefancyasciifile")
xAxisScale = np.linspace(0.0, 80, len(data[0,:]))
yAxisScale = np.linspace(0.0, 80, len(data[0,:]))
fig = plt.figure(figsize = (16, 9), dpi = 100)
ax = fig.add_subplot(111 )
image = ax.contourf(xAxisScale, yAxisScale, data, 51,vmax = 1.0, vmin = 0.0)
colorbar = fig.colorbar(image, ticks = [0.0, 0.5, 1.0])
plt.show()
The default colorscale is correctly adjusted such that deep blue is 0.0 and red is 1.0. My minimum value is something like 0.45 and my maximum value is a little below 1.0. Even though the colors are correctly adjusted as I want them to, the colorbar itself only ranges from my minimum value to my maximum value. However I want the bar to show the entire range from 0.0 to 1.0 with corresponding colors.