Hello i want to create a highlighting on a set of values in a 3D plot(pcolor
).
I didn't find anything on stackoverflow. In In a matplotlib plot, can I highlight specific x-value ranges? there is a example how to do it on a 2D plot. There they using axvspan
this works for rectangular higlighting too but not for othershapes.
The closed i can get to what i need is this...
import numpy as np
import matplotlib.pyplot as plt
arr0 = np.arange(40)
arr1 = np.arange(20)
arr1lim = 12
a, b = np.meshgrid(np.arange(-20, 20), np.arange(-20, 20))
xyrange = a + b
xyrange = xyrange[:, 5: 25]
range0 = np.where(arr1 <= arr1lim)
range1 = np.where(xyrange >= 0)
overlay = np.zeros_like(xyrange, dtype=np.float)
overlay[range1[0], range1[1]] = 1
overlay[:, range0[0][-1]: -1] = 0
overlay[np.where(overlay == 0)] = None
fig = plt.figure()
ax = fig.add_subplot(111)
X, Y = np.meshgrid(arr1, arr0)
workplot = ax.pcolor(X, Y, xyrange)
ax.pcolor(X, Y, overlay, linewidths=0, alpha=0.4, edgecolor=None)
but it looks not as nice as with axvspan
. Some difficulties i have are:
- Adding
color='red'
option don't change the result. - the way it shows edges is ugly is isn't a smooth surface
So are there solution(s) for better higlighting?