I'm doing a graph with pcolor.
My problem is that I want to combine:
cbar = plt.colorbar(ticks = [min(MI), max(MA)])
and
pylab.clim([vmin, vmax]) # Set the color limits of the current image
When I use clim, the ticks disappear.
What I'm doing wrong?
I'm doing a graph with pcolor.
My problem is that I want to combine:
cbar = plt.colorbar(ticks = [min(MI), max(MA)])
and
pylab.clim([vmin, vmax]) # Set the color limits of the current image
When I use clim, the ticks disappear.
What I'm doing wrong?
This is the code:
# IMPORT MODULES
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.colors import LogNorm
import numpy as np
from pylab import *
import numpy.random, numpy, pylab
ER = np.array([[ 1.00000000e-03, -4.20000000e-02, 3.90000000e-01,
8.70000000e-02, 3.22000000e-01, 1.91000000e-01,
-2.50000000e-02, -2.80000000e-02, -1.10000000e-01,
-5.10000000e-02],
[ 2.42000000e-01, -7.60000000e-02, -1.86000000e-01,
-3.00000000e-03, 5.80000000e-02, 2.07000000e-01,
-2.00000000e-02, -1.42000000e-01, 1.20000000e-02,
-1.10000000e-01],
[ -1.72000000e-01, -7.70000000e-02, 4.00000000e-02,
6.70000000e-02, 1.11000000e-01, 3.40000000e-02,
2.33000000e-01, 3.00000000e-03, -4.50000000e-02,
-7.72000000e-01],
[ -1.02000000e-01, -1.64000000e-01, -9.00000000e-02,
-1.00000000e-01, -1.77000000e-01, -1.45000000e-01,
-1.40000000e-01, -1.44000000e-01, -1.50000000e-01,
-3.51000000e-01],
[ -9.90000000e-02, 3.00000000e-03, 1.70000000e-02,
-4.20000000e-02, 3.20000000e-01, -5.60000000e-02,
-1.26000000e-01, -1.32000000e-01, 9.00000000e-03,
1.16000000e-01],
[ 1.23000000e-01, -5.40000000e-02, -6.40000000e-02,
6.00000000e-03, -4.40000000e-02, 2.20000000e-02,
-1.50000000e-02, 2.80000000e-02, -6.86000000e-01,
4.34000000e-01],
[ -2.15000000e-01, -5.50000000e-02, -7.20000000e-02,
-1.28000000e-01, -1.64000000e-01, 6.40000000e-02,
-4.20000000e-02, -6.50000000e-02, -8.00000000e-03,
-1.64600000e+00],
[ 2.15000000e-01, 8.20000000e-02, -1.90000000e-02,
-3.30000000e-02, 8.20000000e-02, 1.00000000e-02,
1.42000000e-01, 5.60000000e-02, 1.85000000e-01,
-3.30000000e-02]])
ER2 = ER.transpose()
# INICIO LA FIGURA
cmin = -100; cmax = 100
figure()
title('PFU Raw velocities')
ER3 = 100*ER2;
pcolor(ER3, shading='flat', cmap = cm.jet)
pylab.clim([cmin, cmax])
MA = []
MI = []
for i in range(len(ER3)):
MA.append(max(ER3[i]))
MI.append(min(ER3[i]))
cbar = plt.colorbar(ticks = [min(MI), max(MA)])
cbar.ax.set_yticklabels([cmin, cmax])
cbar.set_label(r'ERR(cm/s)')
ylabel('Num de Celdas')
show()