In the following example (modified from here) I get an error regarding the use of the extended
keyword when using a log scale:
import matplotlib.pyplot as plt
import numpy as np
from numpy import ma
from matplotlib import colors, ticker, cm
from matplotlib.mlab import bivariate_normal
N = 100
x = np.linspace(-3.0, 3.0, N)
y = np.linspace(-2.0, 2.0, N)
X, Y = np.meshgrid(x, y)
z = (bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0)
+ 0.1 * bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0))
cs = plt.contourf(X, Y, z, locator=ticker.LogLocator(), cmap=cm.PuBu_r, extend='both')
cbar = plt.colorbar()
plt.show()
I have tried this in versions 1.5.3
and 1.5.1
and the exact error is
ValueError: extend kwarg does not work yet with log scale
This is even said in that page so this is no surprise.
I have tried some workarounds to that, such as cs.cmap.colorbar_extend = True
, but, although I get no error, the extended option isn't implemented.
Is there a workaround for this? In other words: can I implement a log scale on contourf
even though the keyword isn't implemented yet?
Thank you.